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 <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct po{
    int fi;
    int se;
    po(int _x=0,int _y=0){
        fi=_x;se=_y;
    }
    bool operator<(const po&oth){
    return fi<oth.fi;
    }
};
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    long long sum=0;
    po e;
    vector<po> all;
    int n=w.size();
    for(int i=0;i<n;++i)all.push_back(po(w[i],i));
    sort(all.begin(),all.end());
    int le=0;
    int r=-1;
    while(true){
        while(r<n&&sum<l){
            sum+=all[++r].fi;
        }
        if(r==n&&sum<l){
            break;
        }
        if(sum>=l&&sum<=u){
            vector<int> ans;
            for(int j=le;j<=r;++j){
                ans.push_back(all[j].se);
            }
     //       cout<<sum<<" "<<le<<" "<<r<<endl;
            return ans;
        }
        sum-=all[le++].fi;
    }
    return std::vector<int>();
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |