# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
137482 |
2019-07-28T02:37:06 Z |
silxikys |
Hacker (BOI15_hac) |
C++14 |
|
2 ms |
376 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |