Submission #101132

#TimeUsernameProblemLanguageResultExecution timeMemory
101132Leonardo_PaesHacker (BOI15_hac)C++11
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10; int vet[maxn], sum[maxn]; int main(){ int n, resp=-1; cin >> n; for(int i=1; i<=n; i++){ cin >> vet[i]; sum[i]=vet[i]+sum[i-1]; } int k = n/2; if(n%2==1)k++; for(int i=1; i<=n; i++){ int left, right; if(i>=k)left=sum[i] - sum[i-k]; else left=sum[i] + sum[n] - sum[n-(k-i)]; if(i+k-1<=n)right = sum[k+i-1] - sum[i-1]; else{ right = sum[n]-sum[i-1] + sum[k-(n-i+1)]; } int u = min(left, right); resp=max(resp, u); } cout << resp << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...