# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124871 | 2019-07-04T04:59:49 Z | 송준혁(#3052) | Kitchen (BOI19_kitchen) | C++14 | 177 ms | 130948 KB |
#include <bits/stdc++.h> using namespace std; int N, M, K, S, T; int A[330], B[330]; int D[330][101010]; int main(){ scanf("%d %d %d", &N, &M, &K); for (int i=1; i<=N; i++){ scanf("%d", &A[i]); S += A[i]; if (A[i] < K){ puts("Impossible"); return 0; } } for (int i=1; i<=M; i++) { scanf("%d", &B[i]); T += B[i]; } memset(D, -1, sizeof D); D[0][0] = 0; for (int i=0; i<M; i++){ for (int j=0; j<=T; j++){ if (D[i][j] == -1) continue; D[i+1][j] = max(D[i+1][j], D[i][j]); D[i+1][j+B[i+1]] = max(D[i+1][j+B[i+1]], D[i][j] + min(N, B[i+1])); } } for (int i=S; i<=T; i++) if (D[M][i] >= N*K){ printf("%d\n", i-S); return 0; } puts("Impossible"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 130836 KB | Output is correct |
2 | Correct | 109 ms | 130756 KB | Output is correct |
3 | Correct | 114 ms | 130940 KB | Output is correct |
4 | Correct | 108 ms | 130808 KB | Output is correct |
5 | Correct | 108 ms | 130808 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 109 ms | 130844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 130836 KB | Output is correct |
2 | Correct | 109 ms | 130756 KB | Output is correct |
3 | Correct | 114 ms | 130940 KB | Output is correct |
4 | Correct | 108 ms | 130808 KB | Output is correct |
5 | Correct | 108 ms | 130808 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 109 ms | 130844 KB | Output is correct |
9 | Correct | 108 ms | 130748 KB | Output is correct |
10 | Correct | 110 ms | 130940 KB | Output is correct |
11 | Correct | 109 ms | 130820 KB | Output is correct |
12 | Correct | 108 ms | 130808 KB | Output is correct |
13 | Correct | 109 ms | 130808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 147 ms | 130948 KB | Output is correct |
2 | Correct | 130 ms | 130804 KB | Output is correct |
3 | Correct | 149 ms | 130808 KB | Output is correct |
4 | Correct | 177 ms | 130824 KB | Output is correct |
5 | Correct | 170 ms | 130768 KB | Output is correct |
6 | Correct | 126 ms | 130808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 114 ms | 130872 KB | Output is correct |
2 | Correct | 117 ms | 130780 KB | Output is correct |
3 | Correct | 108 ms | 130808 KB | Output is correct |
4 | Correct | 108 ms | 130708 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 130836 KB | Output is correct |
2 | Correct | 109 ms | 130756 KB | Output is correct |
3 | Correct | 114 ms | 130940 KB | Output is correct |
4 | Correct | 108 ms | 130808 KB | Output is correct |
5 | Correct | 108 ms | 130808 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 109 ms | 130844 KB | Output is correct |
9 | Correct | 108 ms | 130748 KB | Output is correct |
10 | Correct | 110 ms | 130940 KB | Output is correct |
11 | Correct | 109 ms | 130820 KB | Output is correct |
12 | Correct | 108 ms | 130808 KB | Output is correct |
13 | Correct | 109 ms | 130808 KB | Output is correct |
14 | Correct | 147 ms | 130948 KB | Output is correct |
15 | Correct | 130 ms | 130804 KB | Output is correct |
16 | Correct | 149 ms | 130808 KB | Output is correct |
17 | Correct | 177 ms | 130824 KB | Output is correct |
18 | Correct | 170 ms | 130768 KB | Output is correct |
19 | Correct | 126 ms | 130808 KB | Output is correct |
20 | Correct | 114 ms | 130872 KB | Output is correct |
21 | Correct | 117 ms | 130780 KB | Output is correct |
22 | Correct | 108 ms | 130808 KB | Output is correct |
23 | Correct | 108 ms | 130708 KB | Output is correct |
24 | Correct | 2 ms | 256 KB | Output is correct |
25 | Correct | 124 ms | 130800 KB | Output is correct |
26 | Correct | 132 ms | 130728 KB | Output is correct |
27 | Correct | 120 ms | 130808 KB | Output is correct |
28 | Correct | 143 ms | 130808 KB | Output is correct |
29 | Correct | 158 ms | 130808 KB | Output is correct |
30 | Correct | 177 ms | 130720 KB | Output is correct |