记录编号 |
593801 |
评测结果 |
AAAAAAAAAA |
题目名称 |
数字游戏 |
最终得分 |
100 |
用户昵称 |
┭┮﹏┭┮ |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.136 s |
提交时间 |
2024-09-14 12:04:44 |
内存使用 |
4.05 MiB |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define fi first
#define in inline
#define se second
#define mp make_pair
#define pb push_back
const int N = 1e5+10;
const ll inf = 1e18;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
int n,s,t;
ll a[N],ans = -inf;
int st[N],l = 1,r;
int main(){
freopen("ggame.in","r",stdin);
freopen("ggame.out","w",stdout);
n = read(),s = read(),t = read();
for(int i = 1;i <= n;i++)a[i] = read() + a[i-1];
for(int i = 1;i <= n;i++){
while(l <= r && st[l] < i - t)l++;
if(i >= s){
while(l <= r && a[st[r]] >= a[i-s])r--;
st[++r] = i - s;
}
if(l <= r)ans = max(ans,a[i] - a[st[l]]);
}
printf("%lld\n",ans);
return 0;
}