#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n; int k = ceil(n/2.0), A[2*n+1] = {}, ans = 0; multiset<int> s;
for (int i = 1; i <= 2*n; i++) cin >> A[i], A[i+n] = A[i];
for (int i = 1; i <= 2*n; i++) A[i] += A[i-1];
for (int i = 1; i+k-1 <= 2*n; i++){
s.insert(A[i+k-1]-A[i-1]);
if (i >= k){
ans = max(ans, *s.begin());
s.erase(s.find(A[i]-A[i-k]));
}
}cout<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |