# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997826 | 2024-06-13T00:12:12 Z | daffuwu | Bigger segments (IZhO19_segments) | C++14 | 65 ms | 13136 KB |
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int dp[500069], n, a, mx, p[500069]; long long ps[500069]; int main() { int i, j; scanf("%d", &n); for (i=1; i<=n; i++) { scanf("%d", &a); ps[i] = ps[i-1]+a; } for (i=1; i<=n; i++) { p[i] = max(p[i-1], p[i]); dp[i] = dp[p[i]]+1; j = lower_bound(ps+1, ps+n+1, 2*ps[i]-ps[p[i]])-ps; p[j] = i; } printf("%d\n", dp[n]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 0 ms | 2492 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 0 ms | 2396 KB | Output is correct |
13 | Correct | 0 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 2396 KB | Output is correct |
15 | Correct | 0 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 0 ms | 2492 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 0 ms | 2396 KB | Output is correct |
13 | Correct | 0 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 2396 KB | Output is correct |
15 | Correct | 0 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 0 ms | 2396 KB | Output is correct |
18 | Correct | 0 ms | 2396 KB | Output is correct |
19 | Correct | 0 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2396 KB | Output is correct |
21 | Correct | 0 ms | 2500 KB | Output is correct |
22 | Correct | 0 ms | 2396 KB | Output is correct |
23 | Correct | 0 ms | 2396 KB | Output is correct |
24 | Correct | 0 ms | 2440 KB | Output is correct |
25 | Correct | 1 ms | 2396 KB | Output is correct |
26 | Correct | 1 ms | 2396 KB | Output is correct |
27 | Correct | 1 ms | 2396 KB | Output is correct |
28 | Correct | 0 ms | 2396 KB | Output is correct |
29 | Correct | 1 ms | 2392 KB | Output is correct |
30 | Correct | 0 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 0 ms | 2492 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 0 ms | 2396 KB | Output is correct |
13 | Correct | 0 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 2396 KB | Output is correct |
15 | Correct | 0 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 0 ms | 2396 KB | Output is correct |
18 | Correct | 0 ms | 2396 KB | Output is correct |
19 | Correct | 0 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2396 KB | Output is correct |
21 | Correct | 0 ms | 2500 KB | Output is correct |
22 | Correct | 0 ms | 2396 KB | Output is correct |
23 | Correct | 0 ms | 2396 KB | Output is correct |
24 | Correct | 0 ms | 2440 KB | Output is correct |
25 | Correct | 1 ms | 2396 KB | Output is correct |
26 | Correct | 1 ms | 2396 KB | Output is correct |
27 | Correct | 1 ms | 2396 KB | Output is correct |
28 | Correct | 0 ms | 2396 KB | Output is correct |
29 | Correct | 1 ms | 2392 KB | Output is correct |
30 | Correct | 0 ms | 2396 KB | Output is correct |
31 | Correct | 1 ms | 2396 KB | Output is correct |
32 | Correct | 1 ms | 2396 KB | Output is correct |
33 | Correct | 1 ms | 2396 KB | Output is correct |
34 | Correct | 1 ms | 2396 KB | Output is correct |
35 | Correct | 1 ms | 2392 KB | Output is correct |
36 | Correct | 1 ms | 2392 KB | Output is correct |
37 | Correct | 1 ms | 2392 KB | Output is correct |
38 | Correct | 1 ms | 2396 KB | Output is correct |
39 | Correct | 1 ms | 2396 KB | Output is correct |
40 | Correct | 1 ms | 2396 KB | Output is correct |
41 | Correct | 1 ms | 2488 KB | Output is correct |
42 | Correct | 1 ms | 2396 KB | Output is correct |
43 | Correct | 1 ms | 2396 KB | Output is correct |
44 | Correct | 1 ms | 2396 KB | Output is correct |
45 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 0 ms | 2492 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 0 ms | 2396 KB | Output is correct |
13 | Correct | 0 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 2396 KB | Output is correct |
15 | Correct | 0 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 0 ms | 2396 KB | Output is correct |
18 | Correct | 0 ms | 2396 KB | Output is correct |
19 | Correct | 0 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2396 KB | Output is correct |
21 | Correct | 0 ms | 2500 KB | Output is correct |
22 | Correct | 0 ms | 2396 KB | Output is correct |
23 | Correct | 0 ms | 2396 KB | Output is correct |
24 | Correct | 0 ms | 2440 KB | Output is correct |
25 | Correct | 1 ms | 2396 KB | Output is correct |
26 | Correct | 1 ms | 2396 KB | Output is correct |
27 | Correct | 1 ms | 2396 KB | Output is correct |
28 | Correct | 0 ms | 2396 KB | Output is correct |
29 | Correct | 1 ms | 2392 KB | Output is correct |
30 | Correct | 0 ms | 2396 KB | Output is correct |
31 | Correct | 1 ms | 2396 KB | Output is correct |
32 | Correct | 1 ms | 2396 KB | Output is correct |
33 | Correct | 1 ms | 2396 KB | Output is correct |
34 | Correct | 1 ms | 2396 KB | Output is correct |
35 | Correct | 1 ms | 2392 KB | Output is correct |
36 | Correct | 1 ms | 2392 KB | Output is correct |
37 | Correct | 1 ms | 2392 KB | Output is correct |
38 | Correct | 1 ms | 2396 KB | Output is correct |
39 | Correct | 1 ms | 2396 KB | Output is correct |
40 | Correct | 1 ms | 2396 KB | Output is correct |
41 | Correct | 1 ms | 2488 KB | Output is correct |
42 | Correct | 1 ms | 2396 KB | Output is correct |
43 | Correct | 1 ms | 2396 KB | Output is correct |
44 | Correct | 1 ms | 2396 KB | Output is correct |
45 | Correct | 1 ms | 2396 KB | Output is correct |
46 | Correct | 12 ms | 5464 KB | Output is correct |
47 | Correct | 9 ms | 5468 KB | Output is correct |
48 | Correct | 11 ms | 5860 KB | Output is correct |
49 | Correct | 12 ms | 5980 KB | Output is correct |
50 | Correct | 12 ms | 5980 KB | Output is correct |
51 | Correct | 13 ms | 5932 KB | Output is correct |
52 | Correct | 7 ms | 5212 KB | Output is correct |
53 | Correct | 5 ms | 4956 KB | Output is correct |
54 | Correct | 9 ms | 5212 KB | Output is correct |
55 | Correct | 12 ms | 5976 KB | Output is correct |
56 | Correct | 10 ms | 5468 KB | Output is correct |
57 | Correct | 9 ms | 5468 KB | Output is correct |
58 | Correct | 12 ms | 5556 KB | Output is correct |
59 | Correct | 13 ms | 5436 KB | Output is correct |
60 | Correct | 13 ms | 5576 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 0 ms | 2492 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 0 ms | 2396 KB | Output is correct |
13 | Correct | 0 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 2396 KB | Output is correct |
15 | Correct | 0 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 0 ms | 2396 KB | Output is correct |
18 | Correct | 0 ms | 2396 KB | Output is correct |
19 | Correct | 0 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2396 KB | Output is correct |
21 | Correct | 0 ms | 2500 KB | Output is correct |
22 | Correct | 0 ms | 2396 KB | Output is correct |
23 | Correct | 0 ms | 2396 KB | Output is correct |
24 | Correct | 0 ms | 2440 KB | Output is correct |
25 | Correct | 1 ms | 2396 KB | Output is correct |
26 | Correct | 1 ms | 2396 KB | Output is correct |
27 | Correct | 1 ms | 2396 KB | Output is correct |
28 | Correct | 0 ms | 2396 KB | Output is correct |
29 | Correct | 1 ms | 2392 KB | Output is correct |
30 | Correct | 0 ms | 2396 KB | Output is correct |
31 | Correct | 1 ms | 2396 KB | Output is correct |
32 | Correct | 1 ms | 2396 KB | Output is correct |
33 | Correct | 1 ms | 2396 KB | Output is correct |
34 | Correct | 1 ms | 2396 KB | Output is correct |
35 | Correct | 1 ms | 2392 KB | Output is correct |
36 | Correct | 1 ms | 2392 KB | Output is correct |
37 | Correct | 1 ms | 2392 KB | Output is correct |
38 | Correct | 1 ms | 2396 KB | Output is correct |
39 | Correct | 1 ms | 2396 KB | Output is correct |
40 | Correct | 1 ms | 2396 KB | Output is correct |
41 | Correct | 1 ms | 2488 KB | Output is correct |
42 | Correct | 1 ms | 2396 KB | Output is correct |
43 | Correct | 1 ms | 2396 KB | Output is correct |
44 | Correct | 1 ms | 2396 KB | Output is correct |
45 | Correct | 1 ms | 2396 KB | Output is correct |
46 | Correct | 12 ms | 5464 KB | Output is correct |
47 | Correct | 9 ms | 5468 KB | Output is correct |
48 | Correct | 11 ms | 5860 KB | Output is correct |
49 | Correct | 12 ms | 5980 KB | Output is correct |
50 | Correct | 12 ms | 5980 KB | Output is correct |
51 | Correct | 13 ms | 5932 KB | Output is correct |
52 | Correct | 7 ms | 5212 KB | Output is correct |
53 | Correct | 5 ms | 4956 KB | Output is correct |
54 | Correct | 9 ms | 5212 KB | Output is correct |
55 | Correct | 12 ms | 5976 KB | Output is correct |
56 | Correct | 10 ms | 5468 KB | Output is correct |
57 | Correct | 9 ms | 5468 KB | Output is correct |
58 | Correct | 12 ms | 5556 KB | Output is correct |
59 | Correct | 13 ms | 5436 KB | Output is correct |
60 | Correct | 13 ms | 5576 KB | Output is correct |
61 | Correct | 37 ms | 10064 KB | Output is correct |
62 | Correct | 45 ms | 10068 KB | Output is correct |
63 | Correct | 44 ms | 10580 KB | Output is correct |
64 | Correct | 62 ms | 12772 KB | Output is correct |
65 | Correct | 58 ms | 12892 KB | Output is correct |
66 | Correct | 57 ms | 12896 KB | Output is correct |
67 | Correct | 45 ms | 11604 KB | Output is correct |
68 | Correct | 23 ms | 7248 KB | Output is correct |
69 | Correct | 42 ms | 9308 KB | Output is correct |
70 | Correct | 58 ms | 13136 KB | Output is correct |
71 | Correct | 46 ms | 10068 KB | Output is correct |
72 | Correct | 42 ms | 10580 KB | Output is correct |
73 | Correct | 65 ms | 11088 KB | Output is correct |
74 | Correct | 51 ms | 11344 KB | Output is correct |
75 | Correct | 56 ms | 11356 KB | Output is correct |