# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
957688 |
2024-04-04T08:10:37 Z |
Turkhuu |
Kitchen (BOI19_kitchen) |
C++17 |
|
83 ms |
106840 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, M, K;
cin >> N >> M >> K;
vector<int> A(N), B(M);
for (auto &i : A) cin >> i;
for (auto &i : B) cin >> i;
int s = 0;
for (int i = 0; i < N; i++) {
if (A[i] < K) {
cout << "Impossible";
return 0;
}
s += A[i];
}
vector dp(M + 1, vector<int>(90001, -1e9));
dp[0][0] = 0;
for (int i = 0; i < M; i++) {
dp[i + 1] = dp[i];
for (int j = B[i]; j <= 90000; j++) {
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - B[i]] + min(B[i], N));
}
}
for (int i = s; i <= 90000; i++) {
if (dp[M][i] >= N * K) {
cout << i - s;
return 0;
}
}
cout << "Impossible";
return 6/22;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1628 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
1 ms |
1628 KB |
Output is correct |
4 |
Correct |
1 ms |
1628 KB |
Output is correct |
5 |
Correct |
1 ms |
1736 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1628 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
1 ms |
1628 KB |
Output is correct |
4 |
Correct |
1 ms |
1628 KB |
Output is correct |
5 |
Correct |
1 ms |
1736 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
4 ms |
6236 KB |
Output is correct |
10 |
Correct |
4 ms |
6236 KB |
Output is correct |
11 |
Correct |
4 ms |
6236 KB |
Output is correct |
12 |
Correct |
5 ms |
6236 KB |
Output is correct |
13 |
Correct |
4 ms |
6308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
93064 KB |
Output is correct |
2 |
Correct |
62 ms |
80732 KB |
Output is correct |
3 |
Correct |
81 ms |
106840 KB |
Output is correct |
4 |
Correct |
83 ms |
106836 KB |
Output is correct |
5 |
Correct |
77 ms |
103248 KB |
Output is correct |
6 |
Correct |
56 ms |
74368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
15196 KB |
Output is correct |
2 |
Correct |
11 ms |
15196 KB |
Output is correct |
3 |
Correct |
11 ms |
15196 KB |
Output is correct |
4 |
Correct |
11 ms |
15196 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1628 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
1 ms |
1628 KB |
Output is correct |
4 |
Correct |
1 ms |
1628 KB |
Output is correct |
5 |
Correct |
1 ms |
1736 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
4 ms |
6236 KB |
Output is correct |
10 |
Correct |
4 ms |
6236 KB |
Output is correct |
11 |
Correct |
4 ms |
6236 KB |
Output is correct |
12 |
Correct |
5 ms |
6236 KB |
Output is correct |
13 |
Correct |
4 ms |
6308 KB |
Output is correct |
14 |
Correct |
69 ms |
93064 KB |
Output is correct |
15 |
Correct |
62 ms |
80732 KB |
Output is correct |
16 |
Correct |
81 ms |
106840 KB |
Output is correct |
17 |
Correct |
83 ms |
106836 KB |
Output is correct |
18 |
Correct |
77 ms |
103248 KB |
Output is correct |
19 |
Correct |
56 ms |
74368 KB |
Output is correct |
20 |
Correct |
11 ms |
15196 KB |
Output is correct |
21 |
Correct |
11 ms |
15196 KB |
Output is correct |
22 |
Correct |
11 ms |
15196 KB |
Output is correct |
23 |
Correct |
11 ms |
15196 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
57 ms |
75096 KB |
Output is correct |
26 |
Correct |
65 ms |
86656 KB |
Output is correct |
27 |
Correct |
43 ms |
57436 KB |
Output is correct |
28 |
Correct |
70 ms |
87128 KB |
Output is correct |
29 |
Correct |
68 ms |
89172 KB |
Output is correct |
30 |
Correct |
80 ms |
106788 KB |
Output is correct |