Submission #958133

# Submission time Handle Problem Language Result Execution time Memory
958133 2024-04-05T02:19:38 Z ezzzay Kitchen (BOI19_kitchen) C++14
0 / 100
1 ms 436 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=550;
int a[N];
int b[N];
signed main(){
    int n,m,k;
    cin>>n>>m>>k;
    int s=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]<k){
            cout<<"IMPOSSIBLE";
            return 0;
        }
        s+=a[i];
    }
    for(int i=1;i<=m;i++)cin>>b[i];
    
    int ans=1e9;
    
    for(int i=0;i<(1<<m);i++){
        int tmp=0;
        int cnt=0;
        for(int j=0;j<m;j++){
            if(i<<(j)){
                tmp+=b[j+1];
                cnt++;
            }
        }
        if(cnt<k or tmp<s)continue;
        ans=min(ans,tmp-s);
    }
    if(ans==1e9){
        cout<<"IMPOSSIBLE";
    }
    else cout<<ans;
}

Compilation message

kitchen.cpp: In function 'int main()':
kitchen.cpp:30:17: warning: '<<' in boolean context, did you mean '<'? [-Wint-in-bool-context]
   30 |             if(i<<(j)){
      |                ~^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -