Submission #203621

#TimeUsernameProblemLanguageResultExecution timeMemory
203621mdn2002Hacker (BOI15_hac)C++14
0 / 100
5 ms376 KiB
#include<bits/stdc++.h> using namespace std; long long n,sum,a[1000500]; vector<long long>v; int main() { cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; sum+=a[i]; } for(int i=n;i<2*n;i++)a[i]=a[i-n]; long long sum1=a[0],l=0,r=0,mx=n/2; while(true) { if(r-l+1>mx) { sum1-=a[l]; l++; } if(l==n)break; if(r-l+1==mx)v.push_back(sum-sum1); r++; sum1+=a[r]; } sort(v.begin(),v.end()); cout<<v[(v.size()/2)+(n%2)]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...