# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745918 |
2023-05-21T09:39:19 Z |
vjudge1 |
Kitchen (BOI19_kitchen) |
C++17 |
|
59 ms |
29508 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;
bool lehet[400][100000] = {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 < 100000; ++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 < 100000) ++sol;
if(sol == 100000){
cout << "Impossible" << endl;
}
else{
cout << sol - sumv << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
25656 KB |
Output is correct |
2 |
Correct |
39 ms |
22216 KB |
Output is correct |
3 |
Correct |
59 ms |
29444 KB |
Output is correct |
4 |
Correct |
50 ms |
29508 KB |
Output is correct |
5 |
Correct |
51 ms |
28548 KB |
Output is correct |
6 |
Correct |
35 ms |
20516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
4004 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |