# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42647 | XmtosX | Hacker (BOI15_hac) | C++14 | 575 ms | 35124 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;
int n,v[500005],here[500005],ans;
set <pair<int,int> > s;
int main()
{
scanf("%d",&n);
for (int i=0;i<n;i++)
scanf("%d",&v[i]);
int k= (n/2)+(n%2),cur=0;
for (int i=0;i<k;i++)
cur+=v[i];
for (int i=0;i<n;i++)
{
int j= (i+k)%n;
cur-=v[i];
cur+=v[j];
here[(i+1)%n]=cur;
}
for (int i=0;i<k;i++)
s.insert({here[i],i});
for (int i=0;i<n;i++)
{
int j= (i+k)%n;
s.erase({here[i],i});
s.insert({here[j],j});
ans=max(ans,s.begin()->first);
}
cout <<ans;
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... |