# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745861 |
2023-05-21T08:52:21 Z |
vjudge1 |
Kitchen (BOI19_kitchen) |
C++14 |
|
35 ms |
660 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m >> k;
vector<int>a(n), b(m);
int sum = 0;
for(int i = 0; i < n; i++){
cin >> a[i];
sum += a[i];
}
vector<int> dp(90001, -1);
dp[0] = -2;
for(int i = 0; i < m; i++){
cin >> b[i];
for(int j = b[i]; j <= 90000; j++){
if(dp[j - b[i]] != -1 && dp[j - b[i]] != i && dp[j] == -1){
dp[j] = i;
}
}
}
int mn = INT_MAX;
for(int i = sum; i <= 90000; i++){
if(dp[i] > 0){
mn = min(mn, i - sum);
}
}
if(mn != INT_MAX) cout << mn << endl;
else cout << "Impossible\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
596 KB |
Output is correct |
2 |
Correct |
34 ms |
640 KB |
Output is correct |
3 |
Correct |
25 ms |
660 KB |
Output is correct |
4 |
Correct |
25 ms |
596 KB |
Output is correct |
5 |
Correct |
25 ms |
596 KB |
Output is correct |
6 |
Correct |
32 ms |
648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |