# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833707 | Toster_ | Bank (IZhO14_bank) | C++14 | 4 ms | 212 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;
bool d(vector<int>& n, int t, int in, int sum) {
if (in == n.size()) {
return sum == t;
}if (d(n, t, in + 1, sum + n[in])) {
return true;
}if (d(n, t, in + 1, sum)) {
return true;
}
return false;
}
bool d(vector<int>& n, int t) {
return d(n, t, 0, 0);
}
int main() {
int r,s;
cin>>r>>s;
vector<int> n;
int t;
cin>>t;
for (int i=0; i<s; i++) {
int q;
cin>>q;
n.push_back(q);
}
if (d(n, t)) {
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... |