Submission #499076

#TimeUsernameProblemLanguageResultExecution timeMemory
499076boykutBank (IZhO14_bank)C++14
19 / 100
54 ms312 KiB
#include <bits/stdc++.h> using namespace std; int a[22], b[22]; int main() { ios::sync_with_stdio(0); cin.tie(0); srand(time(NULL)); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; for (int mask = 0; mask < (1 << m); mask++) { int ans = 0; for (int i = 0; i < m; i++) if (mask & (1 << i)) ans += b[i]; if (ans == a[0]) return cout << "YES\n", 0; } cout << "NO\n"; 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...