Submission #1025337

#TimeUsernameProblemLanguageResultExecution timeMemory
1025337kkkkkkkkBank (IZhO14_bank)C++14
19 / 100
2 ms436 KiB
#include <bits/stdc++.h> using namespace std; int n, m; int a[25], b[25]; bool ok=false; void f(int poz, int zbir) { if (poz==m) { if (zbir==a[0]) ok=true; return; } f(poz+1, zbir); f(poz+1, zbir+b[poz]); } int main() { cin >> n >> m; for (int i=0;i<n;i++) cin >> a[i]; for (int i=0;i<m;i++) cin >> b[i]; f(0, 0); if (ok) cout << "YES"; else 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...