# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
289744 |
2020-09-03T02:27:44 Z |
caoash |
Hacker (BOI15_hac) |
C++14 |
|
1 ms |
384 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
vi a(2 * n + 1);
a[0] = 0;
multiset<int> vals;
int SZ = (n + 1) / 2;
for (int i = 1; i <= n; i++) {
cin >> a[i];
a[n + i] = a[i];
a[i] += a[i - 1];
}
int ans = 0;
for (int i = 1; i <= 2 * n; i++) {
if (i + SZ - 1 <= 2 * n) {
vals.insert(a[i + SZ - 1] - a[i - 1]);
}
if (i > SZ) {
vals.erase(vals.find(a[i - 1] - a[i - 1 - SZ]));
}
ans = max(ans, *vals.begin());
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |