This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |