Submission #207083

# Submission time Handle Problem Language Result Execution time Memory
207083 2020-03-06T11:09:11 Z brcode Kitchen (BOI19_kitchen) C++14
21 / 100
160 ms 112632 KB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
const int MAXN = 310;
const int MAXN2 = 310*310;

int a[MAXN];
int b[MAXN];
int dp[MAXN2][MAXN];
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    int holdsum = 0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        holdsum+=a[i];
        if(a[i]<k){
            cout<<"Impossible"<<endl;
            return 0;
        }
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
        
    }
    for(int i=0;i<=304*304;i++){
        for(int j=1;j<=m;j++){
            dp[i][j] = dp[i][j-1];
            if(i-b[j]>=0){
                
                dp[i][j] = max(dp[i][j-1],dp[i-b[j]][j-1]+min(b[j],n));
            }
        }
    }
    for(int i=holdsum;i<=304*304;i++){
        for(int j=1;j<=m;j++){
            if(dp[i][j]>=n*k){
               
                cout<<i-holdsum<<endl;
                return 0;
            }
        }
    }
    cout<<"Impossible"<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 81 ms 112504 KB Output is correct
2 Incorrect 82 ms 112504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 112504 KB Output is correct
2 Incorrect 82 ms 112504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 112632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 95 ms 112504 KB Output is correct
2 Correct 92 ms 112504 KB Output is correct
3 Correct 100 ms 112376 KB Output is correct
4 Correct 94 ms 112376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 112504 KB Output is correct
2 Incorrect 82 ms 112504 KB Output isn't correct
3 Halted 0 ms 0 KB -