# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
596303 |
2022-07-14T14:57:28 Z |
AlesL0 |
Kitchen (BOI19_kitchen) |
C++17 |
|
9 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n, m, k; cin >> n >> m >> k;
vector <ll> a(n), b(n);
ll flag = m, sum = 0;
for (int i = 0; i < n; i++){
cin >> a[i];
flag = min(flag, a[i]);
sum += a[i];
}
if (flag < k){
cout << "impossible";
return 0;
}
for (int i = 0; i < m; i++)cin >> b[i];
vector<ll> dp(9001, -1000);
dp[0] = 0;
for (int i = 0; i < m; i++){
for (int j = 9000-b[i]; j >= 0; j--)dp[j+b[i]] = max(dp[j+b[i]], dp[j]+1);
}
for (int i = sum; i <= 9000; i++){
if (dp[i] >= k){
cout << i-sum;
return 0;
}
}
cout << "impossible";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |