# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
202283 | 2020-02-15T05:31:47 Z | errorgorn | Kitchen (BOI19_kitchen) | C++14 | 47 ms | 764 KB |
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,m,k; int food[305]; int chef[305]; int memo[90005]; int main(){ //freopen("input.txt","r",stdin); scanf("%d%d%d",&n,&m,&k); if (m<k){ printf("Impossible\n"); return 0; } for (int x=0;x<n;x++){ scanf("%d",&food[x]); if (food[x]<k){ printf("Impossible\n"); return 0; } } for (int x=0;x<m;x++){ scanf("%d",&chef[x]); } memset(memo,-1,sizeof(memo)); int total=0; //total hours to cook for (int x=0;x<n;x++) total+=food[x]; memo[0]=0; for (int x=0;x<m;x++){ for (int y=90005-chef[x];y>=0;y--){ if (memo[y]!=-1) memo[y+chef[x]]=max(memo[y+chef[x]],memo[y]+min(n,chef[x])); } } int req=n*k; for (int x=total;x<90005;x++){ if (memo[x]>=req){ printf("%d\n",x-total); return 0; } } printf("Impossible"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 632 KB | Output is correct |
2 | Correct | 5 ms | 632 KB | Output is correct |
3 | Correct | 5 ms | 632 KB | Output is correct |
4 | Correct | 5 ms | 632 KB | Output is correct |
5 | Correct | 5 ms | 632 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 380 KB | Output is correct |
8 | Correct | 5 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 632 KB | Output is correct |
2 | Correct | 5 ms | 632 KB | Output is correct |
3 | Correct | 5 ms | 632 KB | Output is correct |
4 | Correct | 5 ms | 632 KB | Output is correct |
5 | Correct | 5 ms | 632 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 380 KB | Output is correct |
8 | Correct | 5 ms | 636 KB | Output is correct |
9 | Correct | 6 ms | 632 KB | Output is correct |
10 | Correct | 7 ms | 632 KB | Output is correct |
11 | Correct | 7 ms | 636 KB | Output is correct |
12 | Correct | 6 ms | 636 KB | Output is correct |
13 | Correct | 7 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 764 KB | Output is correct |
2 | Correct | 36 ms | 632 KB | Output is correct |
3 | Correct | 40 ms | 632 KB | Output is correct |
4 | Correct | 44 ms | 632 KB | Output is correct |
5 | Correct | 42 ms | 632 KB | Output is correct |
6 | Correct | 30 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 632 KB | Output is correct |
2 | Correct | 10 ms | 632 KB | Output is correct |
3 | Correct | 11 ms | 632 KB | Output is correct |
4 | Correct | 9 ms | 632 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 632 KB | Output is correct |
2 | Correct | 5 ms | 632 KB | Output is correct |
3 | Correct | 5 ms | 632 KB | Output is correct |
4 | Correct | 5 ms | 632 KB | Output is correct |
5 | Correct | 5 ms | 632 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 380 KB | Output is correct |
8 | Correct | 5 ms | 636 KB | Output is correct |
9 | Correct | 6 ms | 632 KB | Output is correct |
10 | Correct | 7 ms | 632 KB | Output is correct |
11 | Correct | 7 ms | 636 KB | Output is correct |
12 | Correct | 6 ms | 636 KB | Output is correct |
13 | Correct | 7 ms | 632 KB | Output is correct |
14 | Correct | 40 ms | 764 KB | Output is correct |
15 | Correct | 36 ms | 632 KB | Output is correct |
16 | Correct | 40 ms | 632 KB | Output is correct |
17 | Correct | 44 ms | 632 KB | Output is correct |
18 | Correct | 42 ms | 632 KB | Output is correct |
19 | Correct | 30 ms | 632 KB | Output is correct |
20 | Correct | 9 ms | 632 KB | Output is correct |
21 | Correct | 10 ms | 632 KB | Output is correct |
22 | Correct | 11 ms | 632 KB | Output is correct |
23 | Correct | 9 ms | 632 KB | Output is correct |
24 | Correct | 4 ms | 256 KB | Output is correct |
25 | Correct | 28 ms | 632 KB | Output is correct |
26 | Correct | 36 ms | 632 KB | Output is correct |
27 | Correct | 27 ms | 632 KB | Output is correct |
28 | Correct | 47 ms | 632 KB | Output is correct |
29 | Correct | 36 ms | 632 KB | Output is correct |
30 | Correct | 42 ms | 632 KB | Output is correct |