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) {
int n = w.size();
vector<pair<int, int>> order(n);
for (int i = 0; i < n; i++) {
order[i].first = w[i];
order[i].second = i;
}
sort(order.begin(), order.end());
long long sum = 0;
int rt = -1;
for (int i = 0; i < n; i++) {
while (sum < l && rt + 1 < n) {
rt++;
sum += order[rt].first;
}
if (l <= sum && sum <= u) {
vector<int> res;
for (int j = i; j <= rt; j++) {
res.push_back(order[j].second);
}
return res;
}
sum -= order[i].first;
}
return vector<int>(0);
}
# | 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... |