# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
377315 |
2021-03-13T21:42:30 Z |
hhh07 |
Kitchen (BOI19_kitchen) |
C++14 |
|
248 ms |
3820 KB |
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <climits>
#include <vector>
#include <queue>
#include <utility>
#include <iomanip>
#include <cstring>
#include <fstream>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll, ll> ii;
ll maks = LLONG_MAX;
ll nnad2(int n){
return n*(n-1)/2;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
int a[n], b[m];
int sum = 0;
for (int i = 0; i < n; i++){
cin >> a[i];
sum += a[i];
if (a[i] < k){
cout << "Impossible";
return 0;
}
}
for (int i = 0; i < m; i++)
cin >> b[i];
if (k > m){
cout << "Impossible";
return 0;
}
vector<int> dp(900001, -1e5);
dp[0] = 0;
for (int i = 0; i < m; i++){
for (int j = 900000 - b[i]; j >= 0 ; j--){
dp[j + b[i]] = max(dp[j + b[i]], dp[j] + min(n, b[i]));
}
}
for (int i = sum; i < 30; i++){
if (dp[i] >= n*k){
cout << i - sum << endl;
return 0;
}
}
cout << "Impossible";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
3820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
3820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
248 ms |
3820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
3820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
3820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |