# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105959 | 2019-04-16T02:44:56 Z | xiaowuc1 | Hacker (BOI15_hac) | C++14 | 2 ms | 384 KB |
#include <algorithm> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<int, pii> pipii; typedef vector<vector<ll>> matrix; int l[1000000]; int maxV[1000000]; void solve() { int n; cin >> n; for(int i = 0; i < n; i++) { cin >> l[i]; } int sz = (n+1)/2; int curr = 0; for(int i = 0; true; i++) { curr += l[i%n]; if(i >= sz) { curr -= l[i-sz]; } if(maxV[i%n]) break; if(i >= sz-1) { maxV[i%n] = curr; } } int ret = 0; multiset<int> all; for(int i = 0; true; i++) { if(i > sz-1 && i%n == sz-1) break; all.insert(maxV[i%n]); if(all.size() > sz) { all.erase(all.begin()); } if(all.size() == sz) { ret = max(ret, *all.begin()); } } cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /* int t; cin >> t; for(int i = 1; i <= t; i++) { cout << "Case #" << i << ": "; solve(); } */ solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |