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>
inline std::vector <int> make(int l, int r) {
std::vector <int> res(r - l + 1);
std::iota(res.begin(), res.end(), l);
return res;
}
std::vector <int> find_subset(int l, int u, std::vector <int> w) {
std::sort(w.begin(), w.end());
long long sum = 0;
int n = w.size();
for (int i = 0; i < n; i++) {
sum += w[i];
if (sum >= l && sum <= u) {
return make(0, i);
}
if (sum > l) {
for (int j = 0; j < i; j++) {
sum -= w[j];
if (sum >= l && sum <= u) {
return make(j + 1, i);
}
}
break;
}
}
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... |