Submission #949626

#TimeUsernameProblemLanguageResultExecution timeMemory
949626HossamHero7Hacker (BOI15_hac)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' void solve(){ int n; cin>>n; vector<ll> v(n); for(auto &i:v) cin>>i; vector<ll> p(n); p = v; for(int i=1;i<n;i++) p[i] += p[i-1]; auto getSum = [&](int l,int r){ if(l <= r) return p[r] - (l ? p[l-1] : 0); return p[n-1] - p[l - 1] + p[r]; }; ll ans = 0; for(int i=0;i<n;i++){ int x = i+((n+1)/2)-1; x %= n; ll ans1 = getSum(i,x); x = i-((n+1)/2)+1; x += n; x %= n; ll ans2 = getSum(x,i); ans = max(ans , min(ans1 , ans2)); } cout<<ans<<endl; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...