# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
896934 |
2024-01-02T11:18:22 Z |
pcc |
Kitchen (BOI19_kitchen) |
C++14 |
|
1000 ms |
55120 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 303;
const int mxc = mxn*mxn*mxn/2;
int N,M,K,arr[mxn],dp[mxc],brr[mxn];
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N>>M>>K;
int sum = 0;
for(int i = 0;i<N;i++)cin>>arr[i],sum += arr[i];
for(int i = 0;i<M;i++)cin>>brr[i];
for(int i = 0;i<N;i++){
if(arr[i]<K){
cout<<"impossible";
return 0;
}
}
memset(dp,-1,sizeof(dp));
dp[0] = 0;
for(int i = 0;i<M;i++){
for(int j = mxc-1;j>=brr[i];j--){
if(dp[j-brr[i]] != -1)dp[j] = max(dp[j],dp[j-brr[i]]+min(brr[i],N));
}
}
for(int i = sum;i<mxc;i++){
if(dp[i]>=N*K){
cout<<i-sum;
return 0;
}
}
cout<<"impossible";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
55120 KB |
Output is correct |
2 |
Correct |
25 ms |
54736 KB |
Output is correct |
3 |
Correct |
25 ms |
54876 KB |
Output is correct |
4 |
Correct |
25 ms |
54872 KB |
Output is correct |
5 |
Correct |
26 ms |
54876 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
55120 KB |
Output is correct |
2 |
Correct |
25 ms |
54736 KB |
Output is correct |
3 |
Correct |
25 ms |
54876 KB |
Output is correct |
4 |
Correct |
25 ms |
54872 KB |
Output is correct |
5 |
Correct |
26 ms |
54876 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1040 ms |
54872 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
380 ms |
54876 KB |
Output is correct |
2 |
Correct |
366 ms |
54872 KB |
Output is correct |
3 |
Correct |
362 ms |
54876 KB |
Output is correct |
4 |
Correct |
362 ms |
54872 KB |
Output is correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
55120 KB |
Output is correct |
2 |
Correct |
25 ms |
54736 KB |
Output is correct |
3 |
Correct |
25 ms |
54876 KB |
Output is correct |
4 |
Correct |
25 ms |
54872 KB |
Output is correct |
5 |
Correct |
26 ms |
54876 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |