Submission #502440

#TimeUsernameProblemLanguageResultExecution timeMemory
502440clamsBank (IZhO14_bank)C++17
19 / 100
63 ms312 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 20; int n, m, a[N + 5], b[N + 5]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; if (n == 1) { bool ok = 0; for (int mask = 1; mask < (1 << m); mask++) { int s = 0; for (int i = 0; i < m; i++) { if ((mask >> i) & 1) { s += b[i]; } } if (s == a[0]) { ok = 1; break; } } 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...