# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162242 | 2019-11-07T09:38:11 Z | jjwdi0 | 스트랩 (JOI14_straps) | C++11 | 104 ms | 31868 KB |
#include <bits/stdc++.h> using namespace std; int N, A[2005], B[2005], D[2005][4005]; int main() { scanf("%d", &N); for(int i=1; i<=N; i++) scanf("%d %d", A+i, B+i); for(int i=0; i<=N; i++) for(int j=0; j<=N+N; j++) D[i][j] = -1e9; D[0][N+1] = 0; int ans = 0; for(int i=0; i<N; i++) for(int j=0; j<=N+N; j++) { int k = min(N+N, j + A[i+1] - 1); if(~k) D[i+1][k] = max(D[i+1][k], D[i][j] + B[i+1]); D[i+1][j] = max(D[i+1][j], D[i][j]); } for(int i=0; i<=N; i++) ans = max(ans, D[N][N+i]); printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 364 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 424 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 424 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 2 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 2 ms | 376 KB | Output is correct |
25 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 888 KB | Output is correct |
3 | Correct | 3 ms | 760 KB | Output is correct |
4 | Correct | 3 ms | 888 KB | Output is correct |
5 | Correct | 3 ms | 760 KB | Output is correct |
6 | Correct | 3 ms | 888 KB | Output is correct |
7 | Correct | 3 ms | 892 KB | Output is correct |
8 | Correct | 19 ms | 12152 KB | Output is correct |
9 | Correct | 18 ms | 12152 KB | Output is correct |
10 | Correct | 19 ms | 12152 KB | Output is correct |
11 | Correct | 22 ms | 12152 KB | Output is correct |
12 | Correct | 55 ms | 31708 KB | Output is correct |
13 | Correct | 55 ms | 31812 KB | Output is correct |
14 | Correct | 55 ms | 31740 KB | Output is correct |
15 | Correct | 55 ms | 31864 KB | Output is correct |
16 | Correct | 54 ms | 31756 KB | Output is correct |
17 | Correct | 54 ms | 31708 KB | Output is correct |
18 | Correct | 89 ms | 31708 KB | Output is correct |
19 | Correct | 54 ms | 31736 KB | Output is correct |
20 | Correct | 54 ms | 31736 KB | Output is correct |
21 | Correct | 54 ms | 31740 KB | Output is correct |
22 | Correct | 54 ms | 31740 KB | Output is correct |
23 | Correct | 54 ms | 31680 KB | Output is correct |
24 | Correct | 54 ms | 31740 KB | Output is correct |
25 | Correct | 54 ms | 31736 KB | Output is correct |
26 | Correct | 69 ms | 31736 KB | Output is correct |
27 | Correct | 54 ms | 31736 KB | Output is correct |
28 | Correct | 54 ms | 31740 KB | Output is correct |
29 | Correct | 58 ms | 31736 KB | Output is correct |
30 | Correct | 55 ms | 31740 KB | Output is correct |
31 | Correct | 56 ms | 31736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 760 KB | Output is correct |
2 | Correct | 2 ms | 760 KB | Output is correct |
3 | Correct | 2 ms | 760 KB | Output is correct |
4 | Correct | 2 ms | 760 KB | Output is correct |
5 | Correct | 2 ms | 760 KB | Output is correct |
6 | Correct | 2 ms | 760 KB | Output is correct |
7 | Correct | 2 ms | 888 KB | Output is correct |
8 | Correct | 2 ms | 784 KB | Output is correct |
9 | Correct | 18 ms | 12152 KB | Output is correct |
10 | Correct | 18 ms | 12152 KB | Output is correct |
11 | Correct | 19 ms | 12152 KB | Output is correct |
12 | Correct | 19 ms | 12280 KB | Output is correct |
13 | Correct | 19 ms | 12152 KB | Output is correct |
14 | Correct | 19 ms | 12152 KB | Output is correct |
15 | Correct | 19 ms | 12152 KB | Output is correct |
16 | Correct | 19 ms | 12152 KB | Output is correct |
17 | Correct | 104 ms | 31756 KB | Output is correct |
18 | Correct | 56 ms | 31708 KB | Output is correct |
19 | Correct | 55 ms | 31800 KB | Output is correct |
20 | Correct | 60 ms | 31864 KB | Output is correct |
21 | Correct | 54 ms | 31736 KB | Output is correct |
22 | Correct | 56 ms | 31708 KB | Output is correct |
23 | Correct | 54 ms | 31736 KB | Output is correct |
24 | Correct | 58 ms | 31764 KB | Output is correct |
25 | Correct | 54 ms | 31736 KB | Output is correct |
26 | Correct | 54 ms | 31736 KB | Output is correct |
27 | Correct | 54 ms | 31736 KB | Output is correct |
28 | Correct | 55 ms | 31740 KB | Output is correct |
29 | Correct | 56 ms | 31736 KB | Output is correct |
30 | Correct | 55 ms | 31736 KB | Output is correct |
31 | Correct | 54 ms | 31864 KB | Output is correct |
32 | Correct | 58 ms | 31736 KB | Output is correct |
33 | Correct | 54 ms | 31736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 55 ms | 31736 KB | Output is correct |
2 | Correct | 55 ms | 31708 KB | Output is correct |
3 | Correct | 54 ms | 31736 KB | Output is correct |
4 | Correct | 54 ms | 31736 KB | Output is correct |
5 | Correct | 55 ms | 31864 KB | Output is correct |
6 | Correct | 57 ms | 31736 KB | Output is correct |
7 | Correct | 54 ms | 31736 KB | Output is correct |
8 | Correct | 54 ms | 31736 KB | Output is correct |
9 | Correct | 54 ms | 31736 KB | Output is correct |
10 | Correct | 55 ms | 31732 KB | Output is correct |
11 | Correct | 55 ms | 31760 KB | Output is correct |
12 | Correct | 55 ms | 31736 KB | Output is correct |
13 | Correct | 57 ms | 31864 KB | Output is correct |
14 | Correct | 56 ms | 31736 KB | Output is correct |
15 | Correct | 54 ms | 31736 KB | Output is correct |
16 | Correct | 54 ms | 31736 KB | Output is correct |
17 | Correct | 54 ms | 31736 KB | Output is correct |
18 | Correct | 58 ms | 31736 KB | Output is correct |
19 | Correct | 58 ms | 31736 KB | Output is correct |
20 | Correct | 55 ms | 31736 KB | Output is correct |
21 | Correct | 63 ms | 31736 KB | Output is correct |
22 | Correct | 55 ms | 31736 KB | Output is correct |
23 | Correct | 56 ms | 31708 KB | Output is correct |
24 | Correct | 55 ms | 31736 KB | Output is correct |
25 | Correct | 54 ms | 31868 KB | Output is correct |