Submission #705702

#TimeUsernameProblemLanguageResultExecution timeMemory
705702ngano_upat_naHacker (BOI15_hac)C++17
0 / 100
1 ms340 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...