记录编号 |
174192 |
评测结果 |
AAAAAAAAAA |
题目名称 |
数字游戏 |
最终得分 |
100 |
用户昵称 |
0 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.068 s |
提交时间 |
2015-07-31 17:11:05 |
内存使用 |
0.70 MiB |
显示代码纯文本
# include <cstdio>
# include <iostream>
# include <cstring>
# include <deque>
using namespace std;
const int MAXN = 100001;
int ans;
int n,s,t;
int a[MAXN];
bool flag;
int temp1;
deque <int> q;
inline int in() {
temp1=0;
char c=getchar();
while(c<48||c>57) {
if(c==45)
flag=1;
c=getchar();
}
for(; c>=48&&c<=57; c=getchar())
temp1=temp1*10+c-48;
if(flag) {
flag=0;
return -temp1;
}
return temp1;
}
int main() {
int i,j,x;
freopen("ggame.in","r",stdin);
freopen("ggame.out","w",stdout);
n=in();
s=in();
t=in();
for(i = 1; i <= n; ++i) {
x=in();
a[i] = a[i - 1] + x;
}
for(i = 1; i <= n; ++i) {
// printf("Normal\n");
while(!q.empty() && i - q.front() > t) q.pop_front();
if(i - s >= 0) {
// printf("Normal\n");
while(!q.empty() && a[q.back()] >= a[i - s]) q.pop_back();
q.push_back(i - s);
}
if(q.empty()) continue;
if(a[i] - a[q.front()] > ans)
ans = a[i] - a[q.front()];
}
printf("%d",ans);
return 0;
}