# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
567303 |
2022-05-23T10:21:58 Z |
1zaid1 |
Kitchen (BOI19_kitchen) |
C++14 |
|
69 ms |
136032 KB |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int M = 3e2+5, MOD = 1e9+7;
int dp[M][M*M];
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
srand(time(0));
int n, m, k;
cin >> n >> m >> k;
if (k > m) {
cout << "Impossible" << endl;
return 0;
}
vector<int> meal(n), cock(m);
int s = 0;
for (int&i:meal) cin >> i;
for (int i:meal) s += i;
int s2 = 0;
for (int&i:cock) cin >> i;
for (int i:cock) s2 += i;
sort(cock.begin(), cock.end());
dp[0][0] = 1;
cout << s << endl;
for (int i = 1; i <= m; i++) {
for (int x = 0; x <= s2; x++) {
dp[i][x] |= dp[i-1][x];
if (dp[i-1][x]) dp[i][x+cock[i-1]] = 1;
}
}
for (int i = s; i < M*M; i++) {
if (dp[m][i]) {
cout << i-s << endl;
return 0;
}
} cout << "Impossible" << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
69 ms |
136032 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |