# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
124845 |
2019-07-04T04:10:49 Z |
윤교준(#3050) |
Kitchen (BOI19_kitchen) |
C++14 |
|
31 ms |
632 KB |
#include <bits/stdc++.h>
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[sz(V)-2])
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
using namespace std;
typedef long long ll;
inline void fuk() { puts("Impossible"); exit(0); }
bitset<1605> D[1605];
int A[44], B[44];
int N, M, K, Asum;
int main() {
ios::sync_with_stdio(false);
cin >> N >> M >> K;
if(M < K) fuk();
for(int i = 1; i <= N; i++) {
cin >> A[i];
if(A[i] < K) fuk();
Asum += A[i];
}
for(int i = 1; i <= M; i++) cin >> B[i];
D[0][0] = true;
for(int i = 1, sum = 0; i <= M; i++) {
for(int bsum = sum; 0 <= bsum; bsum--) {
for(int cnt = N*K; cnt--;)
if(D[bsum][cnt])
D[bsum+B[i]][min(N*K, cnt + min(B[i], N))] = true;
}
sum += B[i];
}
for(int i = Asum; i < 1605; i++)
if(D[i][N*K]) {
cout << i-Asum << endl;
exit(0);
}
fuk();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
504 KB |
Output is correct |
2 |
Correct |
20 ms |
504 KB |
Output is correct |
3 |
Incorrect |
25 ms |
564 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |