Submission #968699

#TimeUsernameProblemLanguageResultExecution timeMemory
968699HaciyevAlikBank (IZhO14_bank)C++14
19 / 100
63 ms492 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define oo 100000000000 const int sz=21; int a[sz],b[sz]; bool dp[1005]; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n,m; cin >> n >> m; for(int i=1;i<=n;++i) { cin >> a[i]; } for(int i=1;i<=m;++i) { cin >> b[i]; } for(int mask=0;mask<(1<<m);++mask){ int sum=0; for(int i=0;i<m;++i) { if(mask>>i&1) { sum += b[i+1]; } } if(sum==a[1]) { return cout<<"YES",0; } } cout << "NO"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...