#include "bits/stdc++.h"
using namespace std;
int main(){
int n; cin >> n;
vector<int> v(2*n);
for(int i = 0; i < n; ++i){
int x; cin >> x;
v[i] = v[i+n] = x;
}
vector<int> ans(n,1e9);
int sum = 0;
int need = (n+1)/2;
for(int i = 0; i < 2*n; ++i){
if(i < need-1) sum += v[i];
else {
// i-need+1...i
sum += v[i];
cerr << i << ' ' << sum << '\n';
for(int j = i-need+1; j <= i; ++j) {
if(j > n) ans[j-n] = min(ans[j-n],sum);
else ans[j] = min(ans[j],sum);
}
sum -= v[i-need+1];
}
}
int res = 0;
for(int i = 0; i < n; ++i){
res = max(res,ans[i]);
}
cout << res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |