# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1021687 | guagua0407 | Hacker (BOI15_hac) | C++17 | 282 ms | 22356 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.
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
const int inf=2e9+5;
int main() {_
int n;
cin>>n;
vector<int> pre(2*n+1);
vector<int> a(n+1);
for(int i=1;i<=n;i++){
cin>>a[i];
pre[i]=a[i]+pre[i-1];
}
for(int i=n+1;i<=2*n;i++){
pre[i]=pre[i-1]+a[i-n];
}
multiset<int> S;
vector<int> mn(n+1,inf);
int k=(n+1)/2;
for(int i=1;i<=2*n;i++){
if(i+k-1<=2*n){
//cout<<"i "<<pre[i+k-1]-pre[i-1]<<'\n';
S.insert(pre[i+k-1]-pre[i-1]);
}
if(i-1>=k){
//cout<<"e "<<pre[i-1]-pre[i-1-k]<<'\n';
S.erase(S.find(pre[i-1]-pre[i-1-k]));
}
int node=(i>n?i-n:i);
if(!S.empty()) mn[node]=min(mn[node],*S.begin());
}
cout<<*max_element(mn.begin()+1,mn.end())<<'\n';
return 0;
}
//maybe its multiset not set
//yeeorz
//laborz
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... |