@[览遍千秋](/user/28910)
by zpy12345 @ 2024-04-09 20:57:56
@[zpy12345](/user/920886) 数据似乎已经增强过一次了,我以前的代码现在过不了了,但你的HACK能过:
以下是AC不了的代码,不算tlqtj
```cpp
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,p[500005],s[500005],l,r,q[500005];
int main(){
// freopen("1.in","r",stdin);
// freopen("1.out","w",stdout);
cin>>n>>m;
for(int i=1;i<=n;i++){
scanf("%lld",&p[i]);s[i]=s[i-1]+p[i];
}l=1,r=0;ll ans=-0x3f3f3f3f;
for(int i=1;i<=n;i++){
while(l<=r&&q[l]<i-m) l++;
ans=max(ans,s[i]-s[q[l]]);
while(l<=r&&s[q[r]]>=s[i]) r--;
q[++r]=i;
}
cout<<ans<<endl;
return 0;
}
```
by zyh0516_lucky @ 2024-04-18 21:37:51
这个题做法太多了,测试点不太全@[zyh0516_lucky](/user/746930)
by zpy12345 @ 2024-04-19 15:16:03
@[zyh0516_lucky](/user/746930) 经过 `assert`,这类 hack 的确没加([捞](https://www.luogu.com.cn/discuss/741020))
by hhce2012 @ 2024-04-24 15:33:49
@[hhc2012](/user/928986) 我的原因是应该`l=r=0`
by zyh0516_lucky @ 2024-04-24 19:14:04
我觉得应该输出0吧,不吃不就幸运值最大了吗
by KomorKomor @ 2024-05-01 19:20:07
@[KomorKomor](/user/1106289) [捞](https://www.luogu.com.cn/discuss/741020) 好好看看评论区,我不想说第三遍。不能不吃蛋糕。
by hhce2012 @ 2024-05-04 16:45:14