# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1099290 |
2024-10-11T06:07:12 Z |
vjudge1 |
Kitchen (BOI19_kitchen) |
C++17 |
|
19 ms |
1176 KB |
#include <bits/stdc++.h>
using namespace std;
long long a[305], b[305], dp[90005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long n, m, k, i, j, check=1;
cin >> n >> m >> k;
for (i=1; i<=n; i++) {cin >> a[i]; if (a[i]<k) {check=0;}; a[i]+=a[i-1];};
dp[0]=0;
for (i=1; i<=90000; i++) {dp[i]=-1;};
for (i=1; i<=m; i++)
{
cin >> b[i];
for (j=90000; j>=b[i]; j--)
{
if (dp[j-b[i]]!=-1) {dp[j]=max(dp[j], dp[j-b[i]]+min(n, b[i]));};
};
};
for (i=a[n]; i<=90000; i++)
{
if (dp[i]>=n*k) {break;};
};
if (check==0 || i==90001) {cout << "Impossible";}
else {cout << i-a[n];};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1116 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
1 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1116 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
1 ms |
1116 KB |
Output is correct |
9 |
Correct |
2 ms |
1112 KB |
Output is correct |
10 |
Correct |
3 ms |
1116 KB |
Output is correct |
11 |
Correct |
2 ms |
1116 KB |
Output is correct |
12 |
Correct |
1 ms |
1116 KB |
Output is correct |
13 |
Correct |
2 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1116 KB |
Output is correct |
2 |
Correct |
15 ms |
1176 KB |
Output is correct |
3 |
Correct |
18 ms |
1116 KB |
Output is correct |
4 |
Correct |
19 ms |
1116 KB |
Output is correct |
5 |
Correct |
18 ms |
980 KB |
Output is correct |
6 |
Correct |
13 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1116 KB |
Output is correct |
2 |
Correct |
3 ms |
1116 KB |
Output is correct |
3 |
Correct |
3 ms |
1116 KB |
Output is correct |
4 |
Correct |
3 ms |
1116 KB |
Output is correct |
5 |
Correct |
3 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1116 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
1 ms |
1116 KB |
Output is correct |
9 |
Correct |
2 ms |
1112 KB |
Output is correct |
10 |
Correct |
3 ms |
1116 KB |
Output is correct |
11 |
Correct |
2 ms |
1116 KB |
Output is correct |
12 |
Correct |
1 ms |
1116 KB |
Output is correct |
13 |
Correct |
2 ms |
1116 KB |
Output is correct |
14 |
Correct |
18 ms |
1116 KB |
Output is correct |
15 |
Correct |
15 ms |
1176 KB |
Output is correct |
16 |
Correct |
18 ms |
1116 KB |
Output is correct |
17 |
Correct |
19 ms |
1116 KB |
Output is correct |
18 |
Correct |
18 ms |
980 KB |
Output is correct |
19 |
Correct |
13 ms |
1116 KB |
Output is correct |
20 |
Correct |
3 ms |
1116 KB |
Output is correct |
21 |
Correct |
3 ms |
1116 KB |
Output is correct |
22 |
Correct |
3 ms |
1116 KB |
Output is correct |
23 |
Correct |
3 ms |
1116 KB |
Output is correct |
24 |
Correct |
3 ms |
1116 KB |
Output is correct |
25 |
Correct |
13 ms |
1116 KB |
Output is correct |
26 |
Correct |
16 ms |
1168 KB |
Output is correct |
27 |
Correct |
10 ms |
1116 KB |
Output is correct |
28 |
Correct |
15 ms |
1164 KB |
Output is correct |
29 |
Correct |
15 ms |
1116 KB |
Output is correct |
30 |
Correct |
19 ms |
1116 KB |
Output is correct |