#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5e5;
int v[MAX_N + 1], sp[MAX_N + 1];
int sum( int l, int r ) {
return sp[r] - sp[l - 1];
}
int main() {
int n;
cin >> n;
for ( int i = 1; i <= n; i++ ) {
cin >> v[i];
sp[i] = sp[i - 1] + v[i];
}
int maxx = 0;
for ( int i = 1; i <= n; i++ ) {
int minn = 1e9;
for ( int l = 0; l < (n + 1) / 2; l++ )
minn = min( minn, sum( i + l, (i + l + (n + 1) / 2 - 2 + n) % n + 1 ) );
maxx = max( maxx, minn );
}
cout << maxx;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2492 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2492 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2492 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |