Submission #589657

#TimeUsernameProblemLanguageResultExecution timeMemory
589657penguinhackerHacker (BOI15_hac)C++17
20 / 100
1093 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array const int mxN=5e5; int n, a[mxN], p[mxN+1]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i=0; i<n; ++i) cin >> a[i]; int ans=0; for (int rep=0; rep<n; ++rep) { for (int i=0; i<n; ++i) p[i+1]=p[i]+a[i]; int mx=0; for (int i=1; i<n; ++i) { int cur=0; for (int j=1; j+n/2-1<n; ++j) { int j2=j+n/2-1; if (i-j<j&&j2-i<n-j2) cur=max(cur, p[j+n/2]-p[j]); } mx=max(mx, cur); } ans=max(ans, p[n]-mx); rotate(a, a+1, a+n); } cout << ans; 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...