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<bits/stdc++.h>
#include "molecules.h"
using namespace std;
using ll=long long;
ll nbVal,minSom,maxSom,deb,fin,somCour;
vector<pair<ll,ll>> listePoids;
vector<int> rep;
vector<int> find_subset(int l,int u,vector<int> w) {
minSom=l;
maxSom=u;
nbVal=w.size();
for (ll i=0;i<nbVal;i++) {
listePoids.push_back({w[i],i});
}
sort(listePoids.begin(),listePoids.end());
fin=nbVal-1;
deb=nbVal;
while (deb>0 and somCour<minSom) {
deb--;
somCour+=listePoids[deb].first;
}
if (somCour<minSom) {
return rep;
}
while (deb>0 and somCour>maxSom) {
somCour-=listePoids[fin].first;
fin--;
deb--;
somCour+=listePoids[deb].first;
}
if (somCour<=maxSom) {
for (int i=deb;i<=fin;i++) {
rep.push_back(listePoids[i].second);
}
}
return rep;
}
# | 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... |