Submission #958170

# Submission time Handle Problem Language Result Execution time Memory
958170 2024-04-05T05:15:44 Z ezzzay Kitchen (BOI19_kitchen) C++14
0 / 100
31 ms 936 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];
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=1;i<=m;i++){
        for(int j=90000;j>=b[i];j--){
            if(dp[j-b[i]]>0 or j-b[i]==0){
                dp[j]=max(dp[j],dp[j-b[i]]+min(b[i],n));
            }
        }
    }
    for(int i=s;i<=90000;i++){
        if(dp[i]>=n*k){
            cout<< i-s;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE";
    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 860 KB Output is correct
2 Correct 23 ms 860 KB Output is correct
3 Correct 28 ms 636 KB Output is correct
4 Correct 31 ms 936 KB Output is correct
5 Incorrect 29 ms 860 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -