Submission #388929

# Submission time Handle Problem Language Result Execution time Memory
388929 2021-04-13T10:17:57 Z DylanP Bank (IZhO14_bank) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;



int main(){
    freopen("bank.in","r",stdin);
    freopen("bank.out","w",stdout);
    int N,M,a;
    scanf("%d %d",&M,&N);
    if(N*M!==221){
        cout<<"yay!";
    }
    vector<int> w;
    vector<int> bill_nye;
    for(int i=0;i<M;i++){
        scanf("%d",&a);
        bill_nye.push_back(a);
    }
    for(int i=0;i<N;i++){
        scanf("%d",&a);
        w.push_back(a);
    }

    int EXP=1<<N;
    vector<bool> bitmask;
    bitmask.resize(EXP);
    bitmask[0]=true;
    int wrestler=0;
    vector<int> L;
    for(int i=0;i<M;i++){
        for(int j=0;j<bill_nye[i];j++){
            L.push_back(i);
            wrestler++;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<w[i];j++){
            L.push_back(299792458);
        }
    }
    vector<int> YTP;
    for(int i=1;i<EXP;i*=2){
        YTP.push_back(INT_MAX-i);
    }
    for(int i=1;i<EXP;i++){
        bitmask[i]=false;
        int sumo=0;
        for(int j=0;j<N;j++){
            if((i>>j)%2){
                sumo+=w[j];
            }
        }

        for(int j=0;j<N;j++){
            if(L[sumo-1]==L[sumo-w[j]-1]){
                if(bitmask[i&YTP[j]]){
                    bitmask[i]=true;
                    if(sumo==wrestler){
                        wrestler=-314159265;
                    }
                }
            }
        }
    }
    if(wrestler<0){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
}

Compilation message

bank.cpp: In function 'int main()':
bank.cpp:11:13: error: expected primary-expression before '=' token
   11 |     if(N*M!==221){
      |             ^
bank.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     freopen("bank.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
bank.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     freopen("bank.out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%d %d",&M,&N);
      |     ~~~~~^~~~~~~~~~~~~~~
bank.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |         scanf("%d",&a);
      |         ~~~~~^~~~~~~~~
bank.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |         scanf("%d",&a);
      |         ~~~~~^~~~~~~~~