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>
#define int long long
using namespace std;
const int MAXN = 5e5 + 9;
int a[MAXN], dp[MAXN];
bool used[MAXN];
signed main(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
dp[i + 1] = dp[i] + a[i];
}
priority_queue<int> pq;
for(int i = 0; i < n; i++){
pq.push(dp[min(i + n / 2 + n % 2, n)] - dp[i] + dp[max(i + n / 2 + n % 2 - n, 0ll)]);
}
pq.pop();
cout << pq.top();
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... |