Submission #881111

#TimeUsernameProblemLanguageResultExecution timeMemory
881111Hovhannes1234Bank (IZhO14_bank)C++17
19 / 100
68 ms600 KiB
#include <bits/stdc++.h> using namespace std; const int N=22; int a[N], b[N]; int main() { int n,m; cin>>n>>m; bool flag=false; for(int i=1; i<=n; i++) cin>>a[i]; for(int i=1; i<=m; i++) cin>>b[i]; for(int i=1; i<(1<<m); i++){ long long ans=0; for(int j=0; j<m; j++){ if(i & (1<<j)){ ans+=b[j]; } } if(ans==a[1]){ flag=true; break; } ans=0; } if(!flag){ cout<<"NO"<<"\n"; return 0; } cout<<"YES"<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...