# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
829160 | 2023-08-18T05:44:36 Z | 1075508020060209tc | Kitchen (BOI19_kitchen) | C++14 | 63 ms | 50968 KB |
#pragma GCC optimize("Ofast, no-stack-protector, unroll-loops") #include <bits/stdc++.h> using namespace std; //#define int long long int n;int m;int K; int ar[510]; int br[510]; int dp[310][90010]; signed main() { cin>>n>>m>>K; for(int i=1;i<=n;i++){ cin>>ar[i]; } for(int i=1;i<=m;i++){ cin>>br[i]; } int S=0; for(int i=1;i<=n;i++){ if(ar[i]<K){cout<<"Impossible";return 0;} S+=ar[i]; } for(int i=0;i<m;i++){ for(int j=0;j<=90000;j++){ if(dp[i][j]==0&&j!=0){continue;} dp[i+1][j]=max(dp[i+1][j],dp[i][j]); int v=j+br[i+1]; if(v>90000){continue;} dp[i+1][v]=max(dp[i+1][v],dp[i][j]+min(n,br[i+1])); } } for(int i=S;i<=90000;i++){ if(dp[m][i]>=n*K){ cout<<i-S<<endl;return 0; } } cout<<"Impossible"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 468 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 336 KB | Output is correct |
12 | Correct | 2 ms | 340 KB | Output is correct |
13 | Correct | 2 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 35236 KB | Output is correct |
2 | Correct | 36 ms | 26464 KB | Output is correct |
3 | Correct | 51 ms | 31016 KB | Output is correct |
4 | Correct | 62 ms | 50124 KB | Output is correct |
5 | Correct | 60 ms | 50220 KB | Output is correct |
6 | Correct | 31 ms | 21708 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 596 KB | Output is correct |
2 | Correct | 4 ms | 468 KB | Output is correct |
3 | Correct | 4 ms | 596 KB | Output is correct |
4 | Correct | 4 ms | 596 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 468 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 336 KB | Output is correct |
12 | Correct | 2 ms | 340 KB | Output is correct |
13 | Correct | 2 ms | 468 KB | Output is correct |
14 | Correct | 43 ms | 35236 KB | Output is correct |
15 | Correct | 36 ms | 26464 KB | Output is correct |
16 | Correct | 51 ms | 31016 KB | Output is correct |
17 | Correct | 62 ms | 50124 KB | Output is correct |
18 | Correct | 60 ms | 50220 KB | Output is correct |
19 | Correct | 31 ms | 21708 KB | Output is correct |
20 | Correct | 4 ms | 596 KB | Output is correct |
21 | Correct | 4 ms | 468 KB | Output is correct |
22 | Correct | 4 ms | 596 KB | Output is correct |
23 | Correct | 4 ms | 596 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 31 ms | 25772 KB | Output is correct |
26 | Correct | 38 ms | 32124 KB | Output is correct |
27 | Correct | 22 ms | 9984 KB | Output is correct |
28 | Correct | 41 ms | 26280 KB | Output is correct |
29 | Correct | 50 ms | 35856 KB | Output is correct |
30 | Correct | 63 ms | 50968 KB | Output is correct |