제출 #723582

#제출 시각아이디문제언어결과실행 시간메모리
723582Mr_HusanboyHacker (BOI15_hac)C++17
20 / 100
184 ms2632 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int inf = 1e9; void solve(){ int n; cin >> n; vector<int> p(n); for(int i = 0; i < n; i ++) cin >> p[i]; int ans = 0; for(int i = 1; i < n; i ++){ p[i] += p[i - 1]; } auto get = [&](int l, int r)->int{ if(l > r){ return p[r] + p[n - 1] - (l ? p[l - 1] : 0); } return p[r] - (l ? p[l - 1] : 0); }; int k = (n + 1) / 2; for(int i = 0; i < n; i ++){ int mn = inf; for(int j = i; j < i + k; j ++){ int r = j % k; int l = ((r - k + 1) % n + n) % n; mn = min(mn, get(l, r)); } ans = max(ans, mn); if(n > 5000) break; } cout << ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int testcases = 1; while(testcases --){ solve(); if(testcases) cout << '\n'; #ifdef LOCAL else cout << '\n'; cout << "__________________________" << endl; #endif } 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...