| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 344608 | bachaquer | Bank (IZhO14_bank) | C++14 | 1 ms | 364 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>
 
#define ll long long
#define pb push_back
 
using namespace std;
 
ll n, x, m;
 
 
int main() {
    cin >> n >> m;
    vector<ll> v, vvv, real;
    for (int i = 0; i < n; i++) {
        cin >> x;
        v.pb(x);
    }
    for (int i = 0; i < m; i++) {
        cin >> x;
        vvv.pb(x);
    }
    sort(vvv.rbegin(), vvv.rend());
    bool tru = true;
    for (int i = 0; i < n; i++) {
        bool bar = false;
        vvv = real;
        for (int j = 0; j < m; j++) {
            x = v[i];
            real = vvv;
            for (int k = j; k < real.size(); k++) {
                if (x - vvv[k] >= 0) {
                    x -= vvv[k];
                    real.erase(real.begin() + j);
                    k--;
                }
                if (x == 0) {
                    bar = true;
                    break;
                }
            }
            if (bar) break;
        }
        if (bar == false) {
            tru = false;
            break;
        }
    }
    if (tru) cout << "YES";
    else cout << "NO";
    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... | ||||
