제출 #125614

#제출 시각아이디문제언어결과실행 시간메모리
125614srvltBank (IZhO14_bank)C++14
19 / 100
2 ms504 KiB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define int long long
using namespace std;

const int M = 21;
int n, m, x, a[M];
bool used[2000];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m>>x;
    if (n > 1) {
        return 0;
    }
    for (int i = 1; i <= m; i++) {
        cin>>a[i];
    }
    used[0] = true;
    for (int j = 1; j <= m; j++) {
        for (int i = x; i >= a[j]; i--) {
            if (used[i - a[j]]) {
                used[i] = true;
            }
        }
    }
    if (used[x]) {
        cout<<"YES";
    }   else {
        cout<<"NO";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...