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<algorithm>
#include<assert.h>
using namespace std;
using ll = long long;
vector<int> find_subset(int weight_low, int weight_hi, vector<int> w) {
sort(w.begin(), w.end());
ll l = 0, r = 0, sum = 0, n = w.size();
while(sum < weight_low or weight_hi < sum){
if(sum < weight_low){
if(n <= r)
return vector<int>();
sum += w[r];
++r;
}
else if(sum > weight_hi){
assert(l <= r);
sum -= w[l];
l++;
}
}
vector<int> ans(w.begin() + l, w.begin() + r);
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... |