# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
382381 | Trunkty | 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.
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long sum=0;
vector<long long> find_subset(long long l, long long u, vector<long long> w){
sort(w.begin(),w.end());
long long lef=0,rit=-1;
while(rit!=w.size()){
rit++;
sum += w[rit];
while(sum>u){
sum -= w[lef];
lef++;
}
if(sum<=u and sum>=l){
vector<long long> a = {};
for(int i=lef;i<=rit;i++){
a.push_back(i);
}
return a;
}
}
return {};
}