Submission #723719

#TimeUsernameProblemLanguageResultExecution timeMemory
723719kas_sHacker (BOI15_hac)C++17
40 / 100
195 ms980 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int N; cin >> N; vector<int> a(N); long long s = 0; for (int &v: a) { cin >> v; s += v; } if (N <= 5000) { long long res = 0; for (int i = 0; i < N; i++) { long long window = 0; int len = N / 2; for (int j = i+1; j < i + len + 1; j++) window += a[j % N]; long long curr = s - window; for (int r = i + len + 1; r % N != i; r++) { window += a[r % N]; window -= a[(r - len) % N]; curr = min(curr, s - window); } res = max(res, curr); } cout << res; return 0; } 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...