# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
350922 | spike1236 | 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.
veci find_subset(int asd, int asdas, veci w) {
ll l = asd, r = asdas;
ll sum = 0;
veci res;
for(int i = 0; i < sz(w); ++i) {
if(l <= w[i] && w[i] <= r) return {i};
if(w[i] < l) {
sum += w[i];
res.pb(i);
}
}
if(sum < l) return {};
while(sum > r && !res.empty()) sum -= w[res.back()], res.pop_back();
return res;
}