This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=5e5;
int n, a[mxN], cur, s[mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i=0; i<n; ++i)
cin >> a[i];
int m=(n+1)/2;
for (int i=0; i<m; ++i)
cur+=a[i];
s[0]=cur;
for (int i=1; i<m; ++i) {
cur+=a[(i+m-1)%n]-a[i-1];
s[i]=cur;
}
int ans=0;
for (int i=0; i<n; ++i)
ans=max(ans, min(s[i], s[(i+m-1)%n]));
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |