# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1114722 |
2024-11-19T13:19:38 Z |
Thunnus |
Hacker (BOI15_hac) |
C++17 |
|
2 ms |
592 KB |
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
#define int i64
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define pii pair<int, int>
#define fi first
#define se second
#define sz(x) (int)(x).size()
signed main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int n;
cin >> n;
const int SZ = (n + 1) / 2;
vi a(2 * n);
for(int i = 0; i < n; i++){
cin >> a[i];
a[n + i] = a[i];
}
for(int i = 1; i < 2 * n; i++){
a[i] += a[i - 1];
}
auto sum = [&](int l, int r) -> int {
if(!l) return a[r];
return a[r] - a[l - 1];
};
multiset<int> s;
vi ans(n, LLONG_MAX);
for(int i = 0; i < 2 * n; i++){
if(i + SZ - 1 < 2 * n) s.emplace(sum(i, i + SZ - 1));
if(i >= SZ) s.erase(s.find(sum(i - SZ, i)));
ans[i % n] = min(ans[i % n], *s.begin());
}
cout << *max_element(ans.begin(), ans.end()) << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |