# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646196 | 2022-09-29T06:50:10 Z | berr | Kitchen (BOI19_kitchen) | C++17 | 56 ms | 640 KB |
#include <bits/stdc++.h> using namespace std; int kp[300*300+5]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m, k, ans=1e9,flag=1, ans2=0, sum2=0; cin>>n>>m>>k; vector<int> a(n), b(m), c(n); ans=0; for(int i=0; i<n; i++) cin>>a[i], ans+=a[i]; for(int i=0; i<m; i++) cin>>b[i]; for(int i=0; i<n; i++) if(a[i]<k) flag=0; for(int i=0; i<m; i++) { for(int l=300*300; l>=0; l--) { if((l==0)||kp[l]) { kp[l+b[i]]=max(kp[l]+min(b[i], n), kp[l+b[i]]); } } } int br=1; for(int l=ans; l<=300*300&&br; l++) { if(kp[l]>=n*k) ans-=l, br=0; } if(flag&&ans<=0) cout<<-ans; else cout<<"Impossible"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 3 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 3 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 324 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 528 KB | Output is correct |
2 | Correct | 20 ms | 468 KB | Output is correct |
3 | Correct | 43 ms | 468 KB | Output is correct |
4 | Correct | 56 ms | 576 KB | Output is correct |
5 | Correct | 48 ms | 556 KB | Output is correct |
6 | Correct | 24 ms | 444 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 320 KB | Output is correct |
3 | Correct | 3 ms | 212 KB | Output is correct |
4 | Correct | 3 ms | 212 KB | Output is correct |
5 | Correct | 3 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 3 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 340 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 324 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 27 ms | 528 KB | Output is correct |
15 | Correct | 20 ms | 468 KB | Output is correct |
16 | Correct | 43 ms | 468 KB | Output is correct |
17 | Correct | 56 ms | 576 KB | Output is correct |
18 | Correct | 48 ms | 556 KB | Output is correct |
19 | Correct | 24 ms | 444 KB | Output is correct |
20 | Correct | 3 ms | 212 KB | Output is correct |
21 | Correct | 4 ms | 320 KB | Output is correct |
22 | Correct | 3 ms | 212 KB | Output is correct |
23 | Correct | 3 ms | 212 KB | Output is correct |
24 | Correct | 3 ms | 212 KB | Output is correct |
25 | Correct | 23 ms | 552 KB | Output is correct |
26 | Correct | 23 ms | 520 KB | Output is correct |
27 | Correct | 19 ms | 340 KB | Output is correct |
28 | Correct | 37 ms | 456 KB | Output is correct |
29 | Correct | 41 ms | 568 KB | Output is correct |
30 | Correct | 56 ms | 640 KB | Output is correct |