# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745913 |
2023-05-21T09:36:41 Z |
vjudge1 |
Kitchen (BOI19_kitchen) |
C++17 |
|
5 ms |
2772 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;
bool lehet[400][10000] = {false};
int main(){
int n, m, k;
cin >> n >> m >> k;
vector<ll> v(n), t(m);
ll sumv = 0;
for(auto& i : v){
cin >> i;
sumv += i;
}
for(auto& i : t){
cin >> i;
}
lehet[0][0] = lehet[0][t[0]] = true;
for(int i = 1; i < m; ++i){
for(int j = 0; j < 10000; ++j){
lehet[i][j] |= lehet[i - 1][j];
if(j >= t[i]){
lehet[i][j] |= lehet[i - 1][j - t[i]];
}
}
}
ll sol = sumv;
while(!lehet[m -1][sol] && sol < 10000) ++sol;
if(sol == 10000){
cout << "Impossible" << endl;
}
else{
cout << sol - sumv << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
2772 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |