Submission #1107314

#TimeUsernameProblemLanguageResultExecution timeMemory
1107314vjudge1Bank (IZhO14_bank)C++17
19 / 100
61 ms588 KiB
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0), cin.tie(0)
#define int long long
#define st first
#define nd second
#define pb push_back
#define love our_kolhoz

using namespace std;
const int N = 1e5 + 10, inf = 1e18, mod = 1e9 + 7;
//koz qorqaq

int n, m;

void solve() {

    cin >> n >> m;
    int a[n], b[m];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }

    if (n == 1) {
        for (int i = 0; i < (1 << m); i++) {
            int kek = 0;
            for (int j = 0; j < m; j++) {
                if (i & (1 << j)) {
                    kek += (b[j]);
                }
            }
            if (kek == a[0]) {
                cout << "YES";
                return;
            }
        }

        cout << "NO";
    }


}

signed main() {

    speed;

    //freopen("points.in ", "r", stdin);
    //freopen("points.out", "w", stdout);

    int _t = 1;
    //cin >> _t;
    while (_t--)
        solve();


    return 0;

}
// sau bol
// there's really no way of winning
// if in their eyes you'll always be a dumb blonde...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...