# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
899526 |
2024-01-06T11:30:34 Z |
dsyz |
Kitchen (BOI19_kitchen) |
C++17 |
|
1000 ms |
71132 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (3005)
ll N,M,K,totalA;
ll A[MAXN], B[MAXN];
ll dp[MAXN * MAXN];
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);
cin>>N>>M>>K;
bool ok = 1;
for(ll i = 0;i < N;i++){ //number of dishes
cin>>A[i];
totalA += A[i];
if(A[i] < K) ok = 0;
}
for(ll i = 0;i < M;i++){ //number of chefs
cin>>B[i];
}
if(!ok){
cout<<"Impossible"<<'\n';
return 0;
}
dp[0] = 0;
for(ll i = 0;i < M;i++){
for(ll j = MAXN * MAXN - 1;j >= B[i];j--){
dp[j] = max(dp[j],dp[j - B[i]] + min(B[i],N));
}
}
ll minimum = 1e18;
for(ll i = totalA;i < MAXN * MAXN;i++){
if(dp[i] >= N * K){
minimum = i;
break;
}
}
if(minimum == 1e18) cout<<"Impossible"<<'\n';
else cout<<minimum - totalA<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
71004 KB |
Output is correct |
2 |
Incorrect |
43 ms |
70904 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
71004 KB |
Output is correct |
2 |
Incorrect |
43 ms |
70904 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
71076 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
340 ms |
71128 KB |
Output is correct |
2 |
Correct |
341 ms |
70992 KB |
Output is correct |
3 |
Correct |
346 ms |
71132 KB |
Output is correct |
4 |
Correct |
342 ms |
71128 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
71004 KB |
Output is correct |
2 |
Incorrect |
43 ms |
70904 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |