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;
#define ll long long int
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector <int> p(n);
for (int i = 0; i < n; ++i) p[i] = i;
sort(p.begin(), p.end(), [&](int u, int v) {
return w[u] < w[v];
});
ll sum = 0;
vector <int> ans;
for (int i = 0, j = 0; i < n; ++i) {
sum += w[p[i]];
while (j <= i && sum > u) {
sum -= w[p[j]];
++j;
}
if (sum >= l) {
for (int k = j; k <= i; ++k) ans.push_back(p[k]);
return ans;
}
}
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... |