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 low, int high, vector<int> w) {
int n = w.size();
vector<int> vec;
for (int i = 0; i < n; ++i) {
vec.push_back(i);
}
sort(vec.begin(), vec.end(), [&] (int x, int y) {
return w[x] < w[y];
});
int l, r;
long long sum;
l = 0, r = -1, sum = 0;
for (auto i : vec) {
sum += w[i], r++;
if (sum > high) sum -= w[vec[l++]];
if (sum >= low && sum <= high) {
vector<int> res;
for (int j = l; j <= r; ++j) res.push_back(vec[j]);
return res;
}
}
return vector<int>();
}
# | 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... |