# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105963 | 2019-04-16T02:54:19 Z | xiaowuc1 | Hacker (BOI15_hac) | C++14 | 672 ms | 18396 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(i >= sz) { auto x = all.find(maxV[(i-sz)]); all.erase(x); } 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 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
22 | Correct | 4 ms | 512 KB | Output is correct |
23 | Correct | 5 ms | 512 KB | Output is correct |
24 | Correct | 5 ms | 512 KB | Output is correct |
25 | Correct | 6 ms | 512 KB | Output is correct |
26 | Correct | 4 ms | 512 KB | Output is correct |
27 | Correct | 2 ms | 384 KB | Output is correct |
28 | Correct | 3 ms | 384 KB | Output is correct |
29 | Correct | 2 ms | 384 KB | Output is correct |
30 | Correct | 4 ms | 512 KB | Output is correct |
31 | Correct | 4 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 50 ms | 2816 KB | Output is correct |
5 | Correct | 178 ms | 6748 KB | Output is correct |
6 | Correct | 298 ms | 8188 KB | Output is correct |
7 | Correct | 257 ms | 9848 KB | Output is correct |
8 | Correct | 672 ms | 16012 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
22 | Correct | 4 ms | 512 KB | Output is correct |
23 | Correct | 5 ms | 512 KB | Output is correct |
24 | Correct | 5 ms | 512 KB | Output is correct |
25 | Correct | 6 ms | 512 KB | Output is correct |
26 | Correct | 4 ms | 512 KB | Output is correct |
27 | Correct | 2 ms | 384 KB | Output is correct |
28 | Correct | 3 ms | 384 KB | Output is correct |
29 | Correct | 2 ms | 384 KB | Output is correct |
30 | Correct | 4 ms | 512 KB | Output is correct |
31 | Correct | 4 ms | 512 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 384 KB | Output is correct |
34 | Correct | 5 ms | 512 KB | Output is correct |
35 | Correct | 50 ms | 2816 KB | Output is correct |
36 | Correct | 178 ms | 6748 KB | Output is correct |
37 | Correct | 298 ms | 8188 KB | Output is correct |
38 | Correct | 257 ms | 9848 KB | Output is correct |
39 | Correct | 672 ms | 16012 KB | Output is correct |
40 | Correct | 8 ms | 768 KB | Output is correct |
41 | Correct | 17 ms | 1152 KB | Output is correct |
42 | Correct | 20 ms | 1416 KB | Output is correct |
43 | Correct | 200 ms | 7672 KB | Output is correct |
44 | Correct | 600 ms | 18172 KB | Output is correct |
45 | Correct | 76 ms | 3832 KB | Output is correct |
46 | Correct | 277 ms | 11228 KB | Output is correct |
47 | Correct | 635 ms | 18256 KB | Output is correct |
48 | Correct | 324 ms | 18396 KB | Output is correct |
49 | Correct | 281 ms | 17692 KB | Output is correct |
50 | Correct | 285 ms | 17656 KB | Output is correct |