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 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 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... |