# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
605853 | jjiangly | Bank (IZhO14_bank) | C++14 | 1 ms | 212 KiB |
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 all(x) x.begin(), x.end()
#define siz(x) int(x.size())
#define ll long long
#define ar array
#define vt vector
#define inf INT_MAX
#define lnf LLONG_MAX
const int nxm = int(2e5) + 7;
int n, m, a[25], b[25];
namespace sub1 {
void exe() {
bool ok = false;
function<void(int, int)> work = [&](int idx, int v) {
if (idx == m) {
ok = (v == a[0] ? true : ok);
return;
}
work(idx + 1, v + a[idx - 1]);
work(idx + 1, v);
};
work(0, 0);
cout << (ok ? "YES" : "NO") << "\n";
}
};
int subtask() {
if (n == 1) {
return 1;
} else if (n <= 10) {
return 2;
} else if (n <= 20 && m <= 14) {
return 3;
}
return 4;
}
int main() {
ios_base::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 (subtask() == 1) {
sub1::exe();
}
return 0;
}
Compilation message (stderr)
# | 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... |