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;
vector<int>find_subset(int l, int u, vector<int>w){
vector<int>p(w.size());
iota(p.begin(), p.end(), 0);
sort(p.begin(), p.end(), [&] (int i, int j) -> bool{
return w[i] < w[j];
});
int index = int(w.size()) - 1, sum = 0;
while(index > -1 && sum < l){
sum += w[p[index--]];
}
int length = int(w.size()) - index - 1;
while(index > -1 && sum > u){
sum -= w[p[index + length]] - w[p[index]];
index--;
}
if(sum > u){
return vector<int>{};
}
vector<int>ans(length);
for(int i = 1; i <= length; i++){
ans[i - 1] = p[index + i];
}
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... |