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>
using namespace std;
vector<int> find_subset(int lf, int rf, vector<int> w) {
int n = w.size();
vector<pair<int, int>> a;
for (int i = 0; i < n; ++i)
a.emplace_back(w[i], i);
sort(a.begin(), a.end());
vector<int> ans;
int sum = 0;
for (int l = 0, r = 0; l < n; ++l) {
while (sum < lf && r < n) {
sum += a[r].first; ++r;
}
if (lf <= sum && sum <= rf) {
for (int i = l; i < r; ++i)
ans.push_back(a[i].second);
break;
}
sum -= a[l].first;
}
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... |