# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851215 | NamPE | Bank (IZhO14_bank) | C++17 | 1046 ms | 600 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;
typedef long long ll;
int main() {
ll n, m;
cin >> n >> m;
vector<ll> a(n), b(m);
for (ll& i : a) {
cin >> i;
}
for (ll& i : b) {
cin >> i;
}
sort(b.begin(), b.end());
do {
ll sum = 0;
ll cur = 0;
for (ll i : b) {
sum += i;
if (sum == a[cur]) {
cur++;
sum = 0;
} else if (sum > a[cur]) {
break;
}
if (cur == a.size()) {
cout << "YES";
return 0;
}
}
} while (next_permutation(b.begin(), b.end()));
cout << "NO";
}
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... |