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;
vector<int> find_subset(int l,int u,vector<int> w){
sort(w.begin(),w.end());
int n = w.size();
vector<int>ans;
vector<int>cur;
queue<pair<int,int> >q;
for(int i=1;i<=n;i++){
while(!q.empty()) q.pop();
cur.clear();
int sum = 0;
for(int j=i-1;j>=0;j--){
sum+=w[n-j-1];
q.push(make_pair(w[n-j-1],n-j-1));
}
if(sum<l) continue;
for(int j=0;j<i;j++){
if(sum<=u && sum>=l){
while(!q.empty()){
ans.push_back(q.front().second);
q.pop();
}
return ans;
}
else{
sum-=q.front().first;
q.pop();
sum+=w[j];
q.push(make_pair(w[j],j));
}
}
}
return ans;
}
# | 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... |