답안 #958157

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
958157 2024-04-05T03:13:34 Z ezzzay Kitchen (BOI19_kitchen) C++14
20 / 100
112 ms 231368 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ff first
#define ss second
const int N=309;
int a[N];
int b[N];
int dp[N][N*N];
signed main(){
    int n,m,k;
    cin>>n>>m>>k;
    int s=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s+=a[i];
    }
    for(int i=1;i<=m;i++)cin>>b[i];
    
    for(int i=1;i<=n;i++){
        if(a[i]<k){
            cout<<"IMPOSSIBLE";
            return 0;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N*N;j++)dp[i][j]=-1e9;
    }
    dp[0][0]=0;
    for(int i=1;i<=m;i++){
        for(int j=b[i];j<=90000;j++){
            dp[i][j] = max(dp[i-1][j], dp[i-1][j - b[i]] + min(b[i], N));
        }
    }
    
    for (int i=s; i<=90000;i++) {
        if (dp[m][i]>=n*k) {
            cout<<i-s;
            return 0;
        }
    }
    cout << "Impossible";
    
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 112 ms 231340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 112 ms 231340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 231364 KB Output is correct
2 Correct 65 ms 231368 KB Output is correct
3 Correct 71 ms 231368 KB Output is correct
4 Correct 72 ms 231248 KB Output is correct
5 Correct 72 ms 231256 KB Output is correct
6 Correct 65 ms 231144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 231368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 112 ms 231340 KB Output isn't correct
2 Halted 0 ms 0 KB -