Submission #137482

#TimeUsernameProblemLanguageResultExecution timeMemory
137482silxikysHacker (BOI15_hac)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn = 5e5+5; int n, v[maxn], pre[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for (int i = 0; i < n; i++) { cin >> v[i]; } pre[0] = v[0]; for (int i = 1; i < n; i++) { pre[i] = pre[i-1] + v[i]; } int sz = (n+1)/2; vector<int> sums; for (int i = 0; i < n; i++) { int l = (i-sz+n) % n; if (l < i) { sums.push_back(pre[i]-pre[l]); } else { sums.push_back(pre[n-1] - (pre[l]-pre[i])); } } sort(sums.begin(),sums.end()); /* for (int j: sums) { cout << j << ' '; } cout << '\n'; */ cout << sums[n/2] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...