Submission #651143

#TimeUsernameProblemLanguageResultExecution timeMemory
651143alvinpiterHacker (BOI15_hac)C++14
20 / 100
1094 ms2260 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n, a[500003], ans; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int cntTakenByPlayer = n/2 + n%2; ans = 0; for (int i = 0; i < n; i++) { // i-th is player's first move int minSum = 1000000000; for (int prev = 0; prev < cntTakenByPlayer; prev++) { int currSum = 0; for (int j = (i - 1 + n)%n, cnt = 0; cnt < prev; j = (j - 1 + n)%n, cnt++) { currSum += a[j]; } for (int j = i, cnt = 0; cnt < cntTakenByPlayer - prev; j = (j + 1)%n, cnt++) { currSum += a[j]; } minSum = min(minSum, currSum); } ans = max(ans, minSum); } cout << ans << 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...