| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1282742 | enzy | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 0 KiB | 
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int r, vector<int> w){
    int sum=0, at=0;
    vector<pair<int,int>>v;
    for(int i=0;i<w.size();i++) v.push_back({w[i],i});
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
        sum+=v[i].first;
        while(sum>r){
            sum-=v[at].second();
            at++;
        }
        if(l<=sum&&sum<=r){
            vector<int>resp;
            for(int j=at;j<=i;j++) resp.push_back(v[j].second);
            return resp;
        }
    }
    return {};
}
