# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
633168 | Alma | Hacker (BOI15_hac) | C++17 | 0 ms | 212 KiB |
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;
#define fi first
#define se second
using ll = long long;
using ii = pair<int,int>;
const int INF = 1e9;
const ll LLINF = 1e18;
using vi = vector<int>;
using vvi = vector<vi>;
void setIO (string fileName) {
ios::sync_with_stdio(false);
cin.tie(NULL);
if (fileName != "std") {
freopen((fileName + ".in").c_str(), "r", stdin);
freopen((fileName + ".out").c_str(), "w", stdout);
}
}
int main() {
setIO("std");
int n;
cin >> n;
vector<ll> a(3*n), p(3*n);
for (int i = 0; i < n; i++) {
cin >> a[i];
a[n+i] = a[2*n+i] = a[i];
}
p[0] = a[0];
for (int i = 1; i < 3*n; i++) {
p[i] = p[i-1] + a[i];
}
ll ans = 0, h = (n+1) / 2;
for (int i = n; i < 2*n; i++) {
ans = max(ans, min(p[i] - p[i-h], p[i+h-1] - p[i-1]));
}
cout << ans << '\n';
return 0;
}
Compilation message (stderr)
# | 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... |