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;
#define ll long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size();
vector <pair <ll,ll> > v;
for(int i=0;i<n;i++){
v.pb({w[i],i});
}
sort(all(v));
ll sum=0,p1=0;
vector <int> ans;
for(int i=0;i<n;i++){
sum+=v[i].ff;
while(sum>u){
sum-=v[p1].ff;
p1++;
}
if(sum>=l && sum<=u){
for(int j=p1;j<=i;j++)ans.pb(v[j].ss);
break;
}
}
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... |