# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745997 |
2023-05-21T10:27:31 Z |
vjudge1 |
Kitchen (BOI19_kitchen) |
C++17 |
|
59 ms |
35276 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 301;
const int MAXS = MAXN*MAXN+1000;
int dp[MAXN][MAXS];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, m, k; cin >> n >> m >> k;
vector<int> a(n+1), b(m+1);
int sum = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i]; sum += a[i];
}
for (int j = 1; j <= m; j++) {
cin >> b[j];
}
dp[0][0] = true;
for (int i = 1; i <= m; i++) {
dp[i][0] = true;
for (int j = b[i]; j < MAXS; j++) {
if (dp[i-1][j-b[i]]) {
dp[i][j] = true;
}
}
}
for (int i = sum; i < MAXS; i++) {
if (dp[m][i]) {
cout << i-sum << "\n";
return 0;
}
}
cout << "Impossible\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
35276 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |