# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465420 |
2021-08-16T02:21:30 Z |
bonopo |
Kitchen (BOI19_kitchen) |
C++14 |
|
10 ms |
564 KB |
#include <bits/stdc++.h>
using namespace std;
#define el "\n"
typedef long long ll;
const int MM = 1e5+5, MOD = 1e9+7;
int N, M, K, wst = 1e9, sum, dp[MM];
int main() {
cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
cin >> N >> M >> K;
for(int i = 1, x; i <= N; i++) cin >> x, wst = min(wst, x), sum += x;
if(wst < K) {
cout << "Impossible" << el; return 0; }
for(int i = 1, x, s = 0; i <= M; i++) {
cin >> x; s += x;
for(int j = s; j >= 0; j--) {
dp[j+x] = max(dp[j+x], dp[j] + x); }
} for(int i = sum; i < MM; i++) if(dp[i] >= N*K) { cout << i - sum << el; return 0; }
cout << "Impossible" << el;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
316 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
316 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
316 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |