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;
// #define int long long
vector<int> find_subset(int l, int r, vector<int> w){
int n = w.size();
vector<pair<int, int>> v(n);
for(int i = 0; i < n; i++){
v[i]={w[i], i};
}
sort(v.begin(), v.end());
vector<int> sol;
for(int i = n-1; i >= 0; i--){
int aux = v[i].first;
vector<int> pos;
pos.push_back(v[i].second);
for(int j = i-1; i >= 0; j--){
if(aux+v[j].first > r) continue;
else{
aux+=v[j].first;
pos.push_back(v[j].second);
}
if(aux >= l) break;
}
if(aux >= l && aux <= r){
sol = pos;
reverse(sol.begin(), sol.end());
break;
}
}
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... |