# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730169 | 2023-04-25T11:23:59 Z | PanosPask | Hacker (BOI15_hac) | C++14 | 70 ms | 13516 KB |
#include <bits/stdc++.h> using namespace std; int n; vector<int> v; //s[i] is the sum of the numbers from i - len + 1 to i vector<int> s; deque<int> sliding_minimum; vector<int> minimum_segment; int main(void) { scanf("%d", &n); v.resize(2 * n); s.resize(2 * n); minimum_segment.assign(n, INT_MAX); for (int i = 0; i < n; i++) { scanf("%d", &v[i]); v[n + i] = v[i]; } int len = n / 2 + n % 2; int cur_s = 0; for (int i = 0; i < len - 1; i++) cur_s += v[i]; for (int i = len - 1; i < 2 * n; i++) { cur_s += v[i]; s[i] = cur_s; while (!sliding_minimum.empty() && sliding_minimum.back() > s[i]) { sliding_minimum.pop_back(); } sliding_minimum.push_back(s[i]); // Remove v[i - len + 1] int rm = i - len + 1; minimum_segment[rm % n] = min(minimum_segment[rm % n], sliding_minimum.front()); if (s[rm] == sliding_minimum.front()) sliding_minimum.pop_front(); cur_s -= v[rm]; } int ans = 0; for (int i = 0; i < n; i++) ans = max(ans, minimum_segment[i]); printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 296 KB | Output is correct |
16 | Correct | 1 ms | 300 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 296 KB | Output is correct |
16 | Correct | 1 ms | 300 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 368 KB | Output is correct |
23 | Correct | 1 ms | 312 KB | Output is correct |
24 | Correct | 1 ms | 308 KB | Output is correct |
25 | Correct | 1 ms | 316 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 10 ms | 2132 KB | Output is correct |
5 | Correct | 24 ms | 4968 KB | Output is correct |
6 | Correct | 32 ms | 6208 KB | Output is correct |
7 | Correct | 41 ms | 7532 KB | Output is correct |
8 | Correct | 61 ms | 12140 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 296 KB | Output is correct |
16 | Correct | 1 ms | 300 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 368 KB | Output is correct |
23 | Correct | 1 ms | 312 KB | Output is correct |
24 | Correct | 1 ms | 308 KB | Output is correct |
25 | Correct | 1 ms | 316 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 212 KB | Output is correct |
33 | Correct | 0 ms | 296 KB | Output is correct |
34 | Correct | 1 ms | 340 KB | Output is correct |
35 | Correct | 10 ms | 2132 KB | Output is correct |
36 | Correct | 24 ms | 4968 KB | Output is correct |
37 | Correct | 32 ms | 6208 KB | Output is correct |
38 | Correct | 41 ms | 7532 KB | Output is correct |
39 | Correct | 61 ms | 12140 KB | Output is correct |
40 | Correct | 2 ms | 468 KB | Output is correct |
41 | Correct | 4 ms | 696 KB | Output is correct |
42 | Correct | 5 ms | 980 KB | Output is correct |
43 | Correct | 26 ms | 5104 KB | Output is correct |
44 | Correct | 70 ms | 12364 KB | Output is correct |
45 | Correct | 12 ms | 2612 KB | Output is correct |
46 | Correct | 36 ms | 7436 KB | Output is correct |
47 | Correct | 60 ms | 12252 KB | Output is correct |
48 | Correct | 55 ms | 13516 KB | Output is correct |
49 | Correct | 51 ms | 12680 KB | Output is correct |
50 | Correct | 56 ms | 12636 KB | Output is correct |