#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
int32_t main(){
fast;
int n;cin>>n;
vector<int> v(3*n+1),pre(3*n+1);
for(int i=1;i<=n;i++){
cin>>v[i];
v[i+2*n]=v[i+n]=v[i];
}
for(int i=1;i<=3*n;i++){
pre[i]=pre[i-1]+v[i];
}
int ans=0;
int p=(n+1)/2;
for(int i=1;i<=n;i++){
ans=max(ans,min(pre[i+n]-pre[i+n-p],pre[i+n+p-1]-pre[i+n-1]));
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |