# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646196 | berr | Kitchen (BOI19_kitchen) | C++17 | 56 ms | 640 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int kp[300*300+5];
int32_t main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int n, m, k, ans=1e9,flag=1, ans2=0, sum2=0; cin>>n>>m>>k;
vector<int> a(n), b(m), c(n);
ans=0;
for(int i=0; i<n; i++) cin>>a[i], ans+=a[i];
for(int i=0; i<m; i++) cin>>b[i];
for(int i=0; i<n; i++) if(a[i]<k) flag=0;
for(int i=0; i<m; i++)
{
for(int l=300*300; l>=0; l--)
{
if((l==0)||kp[l])
{
kp[l+b[i]]=max(kp[l]+min(b[i], n), kp[l+b[i]]);
}
}
}
int br=1;
for(int l=ans; l<=300*300&&br; l++)
{
if(kp[l]>=n*k) ans-=l, br=0;
}
if(flag&&ans<=0) cout<<-ans;
else cout<<"Impossible";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |