# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
996792 | 2024-06-11T08:22:46 Z | daffuwu | Bigger segments (IZhO19_segments) | C++14 | 554 ms | 83492 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[3069][3069], n, a, mx; long long ps[500069]; int main() { int i, j, idx; scanf("%d", &n); for (i=1; i<=n; i++) { scanf("%d", &a); ps[i] = ps[i-1]+a; } ps[n+1] = 1e17; for (i=1; i<=n; i++) { mx = -1e9; for (idx=i+1, j=i-1; idx<=n+1; idx++) { for (; j>=0 && ps[idx]-ps[i]>=ps[i]-ps[j]; j--) { mx = max(mx, 1+dp[j][i]); } dp[i][idx] = mx; // printf("dp[%d][%d] = %d\n", i, idx, dp[i][idx]); } // printf("\n"); } printf("%d\n", dp[n][n+1]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 0 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 0 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 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 | 2 ms | 8540 KB | Output is correct |
17 | Correct | 1 ms | 8540 KB | Output is correct |
18 | Correct | 1 ms | 8540 KB | Output is correct |
19 | Correct | 1 ms | 8540 KB | Output is correct |
20 | Correct | 1 ms | 8540 KB | Output is correct |
21 | Correct | 1 ms | 8540 KB | Output is correct |
22 | Correct | 1 ms | 8540 KB | Output is correct |
23 | Correct | 1 ms | 6492 KB | Output is correct |
24 | Correct | 2 ms | 8540 KB | Output is correct |
25 | Correct | 1 ms | 8540 KB | Output is correct |
26 | Correct | 1 ms | 8540 KB | Output is correct |
27 | Correct | 1 ms | 8540 KB | Output is correct |
28 | Correct | 1 ms | 8540 KB | Output is correct |
29 | Correct | 1 ms | 8540 KB | Output is correct |
30 | Correct | 1 ms | 8652 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 0 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 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 | 2 ms | 8540 KB | Output is correct |
17 | Correct | 1 ms | 8540 KB | Output is correct |
18 | Correct | 1 ms | 8540 KB | Output is correct |
19 | Correct | 1 ms | 8540 KB | Output is correct |
20 | Correct | 1 ms | 8540 KB | Output is correct |
21 | Correct | 1 ms | 8540 KB | Output is correct |
22 | Correct | 1 ms | 8540 KB | Output is correct |
23 | Correct | 1 ms | 6492 KB | Output is correct |
24 | Correct | 2 ms | 8540 KB | Output is correct |
25 | Correct | 1 ms | 8540 KB | Output is correct |
26 | Correct | 1 ms | 8540 KB | Output is correct |
27 | Correct | 1 ms | 8540 KB | Output is correct |
28 | Correct | 1 ms | 8540 KB | Output is correct |
29 | Correct | 1 ms | 8540 KB | Output is correct |
30 | Correct | 1 ms | 8652 KB | Output is correct |
31 | Correct | 18 ms | 37640 KB | Output is correct |
32 | Correct | 17 ms | 37456 KB | Output is correct |
33 | Correct | 23 ms | 37464 KB | Output is correct |
34 | Correct | 17 ms | 37468 KB | Output is correct |
35 | Correct | 18 ms | 37644 KB | Output is correct |
36 | Correct | 35 ms | 37460 KB | Output is correct |
37 | Correct | 19 ms | 33104 KB | Output is correct |
38 | Correct | 12 ms | 26972 KB | Output is correct |
39 | Correct | 31 ms | 37468 KB | Output is correct |
40 | Correct | 15 ms | 37468 KB | Output is correct |
41 | Correct | 16 ms | 37468 KB | Output is correct |
42 | Correct | 16 ms | 37464 KB | Output is correct |
43 | Correct | 17 ms | 37468 KB | Output is correct |
44 | Correct | 19 ms | 37464 KB | Output is correct |
45 | Correct | 20 ms | 37468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 0 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 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 | 2 ms | 8540 KB | Output is correct |
17 | Correct | 1 ms | 8540 KB | Output is correct |
18 | Correct | 1 ms | 8540 KB | Output is correct |
19 | Correct | 1 ms | 8540 KB | Output is correct |
20 | Correct | 1 ms | 8540 KB | Output is correct |
21 | Correct | 1 ms | 8540 KB | Output is correct |
22 | Correct | 1 ms | 8540 KB | Output is correct |
23 | Correct | 1 ms | 6492 KB | Output is correct |
24 | Correct | 2 ms | 8540 KB | Output is correct |
25 | Correct | 1 ms | 8540 KB | Output is correct |
26 | Correct | 1 ms | 8540 KB | Output is correct |
27 | Correct | 1 ms | 8540 KB | Output is correct |
28 | Correct | 1 ms | 8540 KB | Output is correct |
29 | Correct | 1 ms | 8540 KB | Output is correct |
30 | Correct | 1 ms | 8652 KB | Output is correct |
31 | Correct | 18 ms | 37640 KB | Output is correct |
32 | Correct | 17 ms | 37456 KB | Output is correct |
33 | Correct | 23 ms | 37464 KB | Output is correct |
34 | Correct | 17 ms | 37468 KB | Output is correct |
35 | Correct | 18 ms | 37644 KB | Output is correct |
36 | Correct | 35 ms | 37460 KB | Output is correct |
37 | Correct | 19 ms | 33104 KB | Output is correct |
38 | Correct | 12 ms | 26972 KB | Output is correct |
39 | Correct | 31 ms | 37468 KB | Output is correct |
40 | Correct | 15 ms | 37468 KB | Output is correct |
41 | Correct | 16 ms | 37468 KB | Output is correct |
42 | Correct | 16 ms | 37464 KB | Output is correct |
43 | Correct | 17 ms | 37468 KB | Output is correct |
44 | Correct | 19 ms | 37464 KB | Output is correct |
45 | Correct | 20 ms | 37468 KB | Output is correct |
46 | Runtime error | 554 ms | 83492 KB | Execution killed with signal 11 |
47 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 0 ms | 2396 KB | Output is correct |
5 | Correct | 0 ms | 2396 KB | Output is correct |
6 | Correct | 0 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 0 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 1 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 | 2 ms | 8540 KB | Output is correct |
17 | Correct | 1 ms | 8540 KB | Output is correct |
18 | Correct | 1 ms | 8540 KB | Output is correct |
19 | Correct | 1 ms | 8540 KB | Output is correct |
20 | Correct | 1 ms | 8540 KB | Output is correct |
21 | Correct | 1 ms | 8540 KB | Output is correct |
22 | Correct | 1 ms | 8540 KB | Output is correct |
23 | Correct | 1 ms | 6492 KB | Output is correct |
24 | Correct | 2 ms | 8540 KB | Output is correct |
25 | Correct | 1 ms | 8540 KB | Output is correct |
26 | Correct | 1 ms | 8540 KB | Output is correct |
27 | Correct | 1 ms | 8540 KB | Output is correct |
28 | Correct | 1 ms | 8540 KB | Output is correct |
29 | Correct | 1 ms | 8540 KB | Output is correct |
30 | Correct | 1 ms | 8652 KB | Output is correct |
31 | Correct | 18 ms | 37640 KB | Output is correct |
32 | Correct | 17 ms | 37456 KB | Output is correct |
33 | Correct | 23 ms | 37464 KB | Output is correct |
34 | Correct | 17 ms | 37468 KB | Output is correct |
35 | Correct | 18 ms | 37644 KB | Output is correct |
36 | Correct | 35 ms | 37460 KB | Output is correct |
37 | Correct | 19 ms | 33104 KB | Output is correct |
38 | Correct | 12 ms | 26972 KB | Output is correct |
39 | Correct | 31 ms | 37468 KB | Output is correct |
40 | Correct | 15 ms | 37468 KB | Output is correct |
41 | Correct | 16 ms | 37468 KB | Output is correct |
42 | Correct | 16 ms | 37464 KB | Output is correct |
43 | Correct | 17 ms | 37468 KB | Output is correct |
44 | Correct | 19 ms | 37464 KB | Output is correct |
45 | Correct | 20 ms | 37468 KB | Output is correct |
46 | Runtime error | 554 ms | 83492 KB | Execution killed with signal 11 |
47 | Halted | 0 ms | 0 KB | - |