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 <algorithm>
#include <cstdint>
#include <numeric>
#include <vector>
#include "molecules.h"
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
std::vector<uint32_t> p(w.size());
iota(p.begin(), p.end(), 0);
sort(p.begin(), p.end(), [&](auto a, auto b) { return w[a] < w[b]; });
int T{};
size_t i{}, j{};
for (;;) {
if (l <= T && T <= u) { return std::vector<int>(p.begin() + i, p.begin() + j); }
if (T < l && j < p.size()) {
T += w[p[j++]];
} else if (T > u && i < j) {
T -= w[p[i++]];
} else {
return {};
}
}
}
# | 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... |