哦不,是3,4WA QwQ
by Ouaoan @ 2018-10-29 17:02:28
给大括号换行的大佬(虽然只有两个大括号……):
```cpp
#include<bits/stdc++.h>
using namespace std;
#define maxn 500000
#define read(x) scanf("%d",&x)
int n,m;
int a[maxn+5];
int sum[maxn+5];
int que[maxn+5];
int s=1,t=1;
int main()
{
read(n),read(m);
for(int i=1; i<=n; i++) read(a[i]);
for(int i=1; i<=n; i++) sum[i]=sum[i-1]+a[i];
int ans=-1e9;
que[1]=0;
for(int i=1; i<=n; i++)
{
while(sum[i-1]<sum[que[t]]&&t>0) t--;
que[++t]=i-1;
while(i-que[s]>m&&s<t) s++;
ans=max(ans,sum[i]-sum[que[s]]);
}
printf("%d",ans);
return 0;
}
```
by Ouaoan @ 2018-10-29 17:06:09
@[渣儿](/space/show?uid=13117) &&t>=s
by ouuan @ 2018-10-29 17:40:36
@[ouuan](/space/show?uid=49742) QAQ这样啊……谢dalao
by Ouaoan @ 2018-10-29 20:29:38
18 7
15 19 -1 6 -16 -10 -13 10 -4 4 -12 15 -8 0 9 6 0 -11
by steven12138 @ 2018-10-31 13:31:26
```
18 7
15 19 -1 6 -16 -10 -13 10 -4 4 -12 15 -8 0 9 6 0 -11
```
by steven12138 @ 2018-10-31 13:31:33