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;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<ll> v(2*n);
for (int i=0; i<n; i++) {
cin >> v[i];
v[i+n] = v[i];
}
vector<ll> p(2*n+1,0);
for (int i=1; i<=2*n; i++) {
p[i] = v[i - 1] + p[i - 1];
}
int ceil = n/2;
if (n % 2 == 1) ceil++;
int ct = 0;
vector<ll> ans;
for (int i=ceil; ; i++) {
if (ct == n) break;
ll d = p[i] - p[ct];
ans.push_back(d);
ct++;
}
sort(ans.begin(),ans.end());
cout << ans[n/2];
}
# | 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... |