Submission #811770

#TimeUsernameProblemLanguageResultExecution timeMemory
811770exodus_Bank (IZhO14_bank)C++14
19 / 100
67 ms300 KiB
#include<bits/stdc++.h> using namespace std; int main() { int N,M; int pip[21]; cin >> N >> M; vector<int>vek(M); for(int i=1; i<=N; i++) { cin >> pip[i]; } for(int i=0; i<M; i++) { cin >> vek[i]; } bool ada=false; for(int mask=0; mask<(1<<M); mask++) { int sum = 0; for(int i=0; i<M; i++) { if((mask>>i)&1==true) sum+=vek[i]; } if(sum==pip[1]) { ada=true; break; } } if(ada) cout << "YES"; else cout << "NO"; return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:18:27: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   18 |             if((mask>>i)&1==true) sum+=vek[i];
      |                          ~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...