# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
31671 |
2017-08-30T15:37:00 Z |
Dat160601 |
Hacker (BOI15_hac) |
C++14 |
|
0 ms |
9988 KB |
#include <bits/stdc++.h>
using namespace std;
int n,a[1000007],pre[1000007],ans=0;
deque <int> cur;
int main(){
ios_base::sync_with_stdio(0);
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
a[n+i]=a[i];
}
int sz=(n/2)+(n%2);
for(int i=1;i<=sz;i++){
pre[1]+=a[i];
}
for(int i=2;i<=n;i++){
pre[i]=pre[i-1]+a[i+sz-1]-a[i-1];
}
for(int i=n+1;i<=2*n;i++) pre[n+i]=pre[i];
for(int i=1;i<=2*n;i++){
while(!cur.empty() && pre[cur.front()]>=pre[i]) cur.pop_front();
cur.push_back(i);
if(i-cur.front()==sz) cur.pop_front();
if(i>=sz) ans=max(ans,pre[cur.front()]);
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9988 KB |
Output is correct |
2 |
Incorrect |
0 ms |
9988 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9988 KB |
Output is correct |
2 |
Incorrect |
0 ms |
9988 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
9988 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9988 KB |
Output is correct |
2 |
Incorrect |
0 ms |
9988 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |