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;
int N;
vector<int> sol;
bool dfs(int n, int s, int l, int u, vector<int> &w, bool v[]){
v[n] = 1;
sol.push_back(n);
if(s >= l){
return true;
}
for(int i=0; i<N; i++){
if(!v[i] && s + w[i] <= u){
if(dfs(i, s + w[i], l, u, w, v)){
return true;
}
}
}
v[n] = 0;
sol.pop_back();
return false;
}
vector<int> find_subset(int l, int u, vector<int> w){
N = w.size();
int i = 0;
bool v[N] = {0};
while(i < N && !dfs(i, w[i], l, u, w, v)){
i++;
}
return sol;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |