# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344959 | antontsiorvas | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 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.
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
std::vector<int> ret, ret2;
std::sort(w.begin(),w.end());
if(u < w[0]) return ret;
int hi=w.size()-1;
while(l > 0 && u > 0 && hi >= 0){
while(w[hi] > u) hi--;
if(u-w[hi] >= 0){
ret.push_back(w[hi]);
l -= w[hi];
u -= w[hi];
hi--;
}
}
if(l <= 0 && u >= 0) return ret;
return ret2;
}