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>
using namespace std;
using pii = pair<int,int>;
using ll = long long int;
#define pb push_back
#define F first
#define S second
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pii> vec;
vector<int> ans;
vector<ll> ps={0};
int n=w.size();
for(int i=0; i<n; i++) vec.pb({w[i],i});
sort(vec.begin(),vec.end());
int L=-1,R;
for(int i=0; i<n; i++){
ll x=ps.back()+vec[i].F;
ps.pb(x);
if(x<l) continue;
if(x<=u){
L=0;
R=i;
break;
}
int t=lower_bound(ps.begin(),ps.end(),x-u)-ps.begin();
if(t<(int)ps.size() && x-ps[t]>=l){
L=t;
R=i;
break;
}
}
if(L!=-1){
for(int i=L; i<=R; i++) ans.pb(vec[i].S);
}
return ans;
}
# | 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... |