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 <vector>
#include <algorithm>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size();
vector<pair<int,int> >mol(n);
for(int i=0;i<n;i++)mol[i]={w[i],i};
sort(mol.begin(),mol.end());
int ans=0,j=-1;
for(int i=0;i<n;i++){
while(j<n&&mol[j].first+ans<=u){
ans+=mol[j].first;
j++;
}
if(ans>=l){
vector<int> sol;
for(int k=i;k<j;k++)sol.push_back(mol[i].second);
return sol;
}
}
return vector<int>(0);
}
# | 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... |