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 ins insert
#define pb push_back
#define endl '\n'
#define putr(x) cout<<x<<endl;return;
#define all(x) x.begin(),x.end()
#define _ << " " <<
vector<int> find_subset(int l, int u, vector<int> arr) {
int n = arr.size();
vector<pair<int,int>> lst;
for(int i=0;i<n;i++){
lst.pb({arr[i],i});
}
sort(all(lst));
int lx=0;
int rx=0;
vector<int> ans;
int sum=0;
for(int i=0;i<n;i++){
rx=i;
sum+=lst[i].first;
while(sum>u){
sum-=lst[lx].first;
lx++;
}
if(sum<=u && sum>=l){
for(int j=lx;j<=rx;j++){
ans.pb(lst[j].second);
}
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... |