# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
567143 |
2022-05-23T08:26:09 Z |
Rifal |
Kitchen (BOI19_kitchen) |
C++14 |
|
20 ms |
368 KB |
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
const int M = 9e4 + 5;
bool dp[M] = {};
void add(int x)
{
for(int i = M-1; i >= x; i--)
{
if(dp[i-x])
dp[i] = 1;
}
}
int main()
{
int n, m, k;
cin >> n >> m >> k;
int meal[n], chef[m];
dp[0] = 1;
long long sum = 0;
for(int i = 0; i < n; i++)
{
cin >> meal[i];
sum += meal[i];
}
for(int i = 0; i < m; i++)
{
cin >> chef[i];
add(chef[i]);
}
bool check = false;
long long ans = 0;
for(int i = sum; i < M; i++)
{
if(dp[i])
{
check = true;
ans = i-sum;
break;
}
}
if(check)
cout << ans;
else
cout << "Impossible";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
19 ms |
340 KB |
Output is correct |
2 |
Correct |
17 ms |
336 KB |
Output is correct |
3 |
Correct |
19 ms |
340 KB |
Output is correct |
4 |
Correct |
19 ms |
324 KB |
Output is correct |
5 |
Correct |
20 ms |
368 KB |
Output is correct |
6 |
Correct |
17 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
- |