# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
465640 |
2021-08-16T15:39:46 Z |
bonopo |
Kitchen (BOI19_kitchen) |
C++14 |
|
26 ms |
716 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define rc (i<<1)|1
#define lc (i<<1)
#define el "\n"
#define f first
#define s second
typedef long long ll;
const int MM=1e5+5, MOD=1e9+7, LOG=19;
int N, M, K, dp[MM], mn=1e9, sm;
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin>>N>>M>>K;
for(int i=1, x; i<=N; ++i) {
cin>>x, sm+=x, mn=min(mn, x); }
if(mn<K) {
return cout<<"Impossible", 0; }
for(int i=1, x; i<=M; ++i) {
cin>>x;
for(int j=MM-1; j>=x; --j) dp[j]=max(dp[j], dp[j-x]+min(x, N));
}
for(int i=sm; i<MM; ++i) if(dp[i]>=N*K) {
return cout<<i-sm<<el, 0; }
cout<<"Impossible"<<el;
}
// MM
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
588 KB |
Output is correct |
2 |
Incorrect |
1 ms |
588 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
588 KB |
Output is correct |
2 |
Incorrect |
1 ms |
588 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
712 KB |
Output is correct |
2 |
Correct |
5 ms |
588 KB |
Output is correct |
3 |
Correct |
4 ms |
588 KB |
Output is correct |
4 |
Correct |
5 ms |
588 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
588 KB |
Output is correct |
2 |
Incorrect |
1 ms |
588 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |