Submission #388927

#TimeUsernameProblemLanguageResultExecution timeMemory
388927DylanPBank (IZhO14_bank)C++14
19 / 100
136 ms428 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int N,M,a; scanf("%d %d",&M,&N); 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 (stderr)

bank.cpp: In function 'int main()':
bank.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     scanf("%d %d",&M,&N);
      |     ~~~~~^~~~~~~~~~~~~~~
bank.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |         scanf("%d",&a);
      |         ~~~~~^~~~~~~~~
bank.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |         scanf("%d",&a);
      |         ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...