# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
216109 | 2020-03-26T17:57:24 Z | MKopchev | Kitchen (BOI19_kitchen) | C++14 | 1000 ms | 9976 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=3e2+42; void no() { printf("Impossible"); exit(0); } int take_min(int a,int b) { if(a==-1)return b; return min(a,b); } bool can[nmax*nmax][nmax];//sum, chefs int n,m,k; int main() { scanf("%i%i%i",&n,&m,&k); int sum=0,dish; for(int i=1;i<=n;i++) { scanf("%i",&dish); if(dish<k)no(); sum=sum+dish; } can[0][0]=1; int chef,ret=-1,total=0; for(int i=1;i<=m;i++) { scanf("%i",&chef); total=total+chef; for(int j=total;j>=0;j--) for(int p=i;p>=1;p--) if(j>=chef&&can[j-chef][p-1])can[j][p]=1; } for(int j=total;j>=sum;j--) for(int p=m;p>=k;p--) if(can[j][p])ret=take_min(ret,j); if(ret==-1)no(); printf("%i\n",ret); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 9976 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 768 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |