Submission #633147

#TimeUsernameProblemLanguageResultExecution timeMemory
633147a_aguiloHacker (BOI15_hac)C++14
0 / 100
1080 ms852 KiB
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; vi pre, computers; int N; int calcInterval(int left, int right){ if(left > right) return pre[N-1] - (pre[left]-pre[right]); return pre[right] - pre[left]; } int main(){ cin >> N; computers = vi(N); pre = vi(N); cin >> computers[0]; pre[0] = computers[0]; for(int i = 1; i < N; ++i){ cin>> computers[i]; pre[i] = pre[i-1] + computers[i]; } int length = N/2 + N%2; int ans = 0; for(int start = 0; start < N; ++start){ int val = calcInterval((start-1 + N)%N, (start + length-1)%N); for(int left = 0; left < N; ++left){ int right = (left + length)%N ; if ((left < start and right>= start) or (right >= start and left > right)) val = min(val, calcInterval(left, right)); } //cout << start << " " << val << endl; ans = max(ans, val); } cout << ans << endl; 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...