# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
854887 |
2023-09-29T09:23:58 Z |
aymanrs |
Kitchen (BOI19_kitchen) |
C++14 |
|
19 ms |
788 KB |
#include<bits/stdc++.h>
using namespace std;
void solve(){
int n, m, k;cin >> n >> m >> k;
int a[n], b[m], s = 0;
for(int i = 0;i < n;i++) {
cin >> a[i];
s += a[i];
if(a[i] < k){
cout << "Impossible\n";
return;
}
}
for(int i = 0;i < m;i++) cin >> b[i];
const int ax = 300;
int dp[n*ax+1];
fill(dp, dp+n*ax+1, int(-1e6));
dp[0] = 0;
for(int i = 0;i < m;i++){
for(int j = n*ax;j >= b[i];j--){
dp[j] = max(dp[j], dp[j-b[i]]+min(n, b[i]));
}
}
for(int h = 0;s <= n*ax;s++,h++){
if(dp[s] >= n*k){
cout << h << '\n';
return;
}
}
cout << "Impossible\n";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
600 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
600 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
456 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
604 KB |
Output is correct |
2 |
Correct |
15 ms |
604 KB |
Output is correct |
3 |
Correct |
19 ms |
604 KB |
Output is correct |
4 |
Correct |
19 ms |
784 KB |
Output is correct |
5 |
Correct |
19 ms |
604 KB |
Output is correct |
6 |
Correct |
14 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
600 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
456 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
17 ms |
604 KB |
Output is correct |
15 |
Correct |
15 ms |
604 KB |
Output is correct |
16 |
Correct |
19 ms |
604 KB |
Output is correct |
17 |
Correct |
19 ms |
784 KB |
Output is correct |
18 |
Correct |
19 ms |
604 KB |
Output is correct |
19 |
Correct |
14 ms |
600 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
9 ms |
688 KB |
Output is correct |
26 |
Correct |
12 ms |
688 KB |
Output is correct |
27 |
Correct |
6 ms |
604 KB |
Output is correct |
28 |
Correct |
11 ms |
604 KB |
Output is correct |
29 |
Correct |
11 ms |
684 KB |
Output is correct |
30 |
Correct |
18 ms |
788 KB |
Output is correct |