# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379622 | Pichon5 | Detecting Molecules (IOI16_molecules) | C++17 | 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 "molecules.h"
#include <bits/stdc++.h>
#define vi vector<int>
using namespace std;
vector<int> find_subset(int l, int u,vector<int> w){
vi res;
vector<pair<int,int> >v;
for(int i=0;i<w.size();i++){
v.pb({w[i],i+1});
}
sort(w.begin(),w.end());
ll sum=0;
for(int i=0;i<w.size();i++){
sum+=v[i].F;
if(sum>u){
res.clear();
return res;
}
if(sum>=L && sum<=u){
return res;
}
}
res.clear();
return res;
}