Submission #752754

#TimeUsernameProblemLanguageResultExecution timeMemory
752754DeathIsAweBank (IZhO14_bank)C++17
19 / 100
72 ms292 KiB
#include <bits/stdc++.h> using namespace std; int main() { bool ans=false; int n,m,dum; cin >> n >> m; vector<int> salaries; vector<int> banknotes; for (int i=0;i<n;i++) { cin >> dum; salaries.push_back(dum); } for (int i=0;i<m;i++) { cin >> dum; banknotes.push_back(dum); } int val,icopy,count; for (int i=0;i<pow(2,m)-1;i++) { val=0; icopy=i; count=0; while (icopy>0) { if (icopy%2==1) { val+=banknotes[count]; } count++; icopy>>=1; } if (val==salaries[0]) { ans=true; break; } } if (ans) { cout << "YES"; } else { cout << "NO"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...