#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PUB push_back
int N, dapat;
ll data[500005],
sliding = 0,
ans = 0;
vector <ll> score;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> N;
dapat = (N+1)/2;
for(int i=0;i<N;i++){
cin >> data[i];
}
for(int i=0;i<dapat;i++) sliding += data[i];
score.PUB(sliding);
for(int i=1;i<N;i++){
int right = (dapat+i-1)%N;
sliding = sliding-data[i-1]+data[right];
score.PUB(sliding);
}
sort(score.begin(), score.end());
for(ll elm:score){
if(elm != score.back()) ans = max(ans, elm);
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
484 KB |
Output is correct |
2 |
Incorrect |
2 ms |
544 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |