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 <vector>
#include "molecules.h"
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
sort(w.begin(), w.end());
int T{};
std::vector<int> S{};
size_t i{};
while (i < w.size() && T + w[i] <= u) {
T += w[i];
S.push_back(i);
++i;
}
while (i < w.size() && T < l) {
T += w[i] - w[S[i % S.size()]];
S[i % S.size()] = i;
++i;
}
return l <= T && T <= u ? S : std::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... |