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 ll long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll le,re,hz,n,i,L,R;
vector<int> v;
pair<ll,ll> a[1010101];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
le=0;
re=-1;
hz=0;
n=w.size();
L=l;
R=u;
for(i=0;i<n;i++)
a[i]=mp(w[i],i);
sort(a,a+n);
while(1)
{
while(hz<L)
{
re++;
if(re>=n)
return v;
hz+=a[re].fi;
}
if(L<=hz&&hz<=R)
{
for(i=le;i<=re;i++)
v.push_back(a[i].se);
return v;
}
while(hz>R)
{
hz-=a[le].fi;
le++;
if(le>=n)
return v;
}
if(L<=hz&&hz<=R)
{
if(le<0||re>=n||le>re)
return v;
for(i=le;i<=re;i++)
v.push_back(a[i].se);
return v;
}
}
return v;
}
# | 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... |