# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
124890 |
2019-07-04T05:37:55 Z |
윤교준(#3050) |
Kitchen (BOI19_kitchen) |
C++14 |
|
10 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); }
int D[90005];
int A[305], B[305];
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];
sort(B+1, B+M+1);
for(int i = 1, sum = 0; i <= M; i++) {
sum += B[i];
for(int bsum = sum; B[i] <= bsum; bsum--) {
int t = min(N*K, D[bsum-B[i]] + min(B[i], N));
if(D[bsum] < t) D[bsum] = t;
}
}
for(int i = Asum; i < 90005; i++)
if(N*K == D[i]) {
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 |
380 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 |
380 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 |
Incorrect |
10 ms |
632 KB |
Output isn't correct |
2 |
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 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |