답안 #207081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207081 2020-03-06T11:08:02 Z brcode Kitchen (BOI19_kitchen) C++14
21 / 100
152 ms 109564 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<=300*300;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<=300*300;i++){
        for(int j=1;j<=m;j++){
            if(dp[i][j]>=n*k){
               
                cout<<i-holdsum<<endl;
                return 0;
            }
        }
    }
    cout<<"Impossible"<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 109536 KB Output is correct
2 Incorrect 87 ms 109560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 109536 KB Output is correct
2 Incorrect 87 ms 109560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 152 ms 109560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 109560 KB Output is correct
2 Correct 91 ms 109564 KB Output is correct
3 Correct 92 ms 109564 KB Output is correct
4 Correct 95 ms 109560 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 109536 KB Output is correct
2 Incorrect 87 ms 109560 KB Output isn't correct
3 Halted 0 ms 0 KB -