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 <algorithm>
using namespace std;
vector<int> find_subset(int low, int upp, vector<int> w) {
int n = w.size();
vector<int> a(n);
for (int i = 0; i < n; ++i) a[i] = i;
sort(a.begin(), a.end(), [&](int x, int y) { return w[x] < w[y]; });
int sum = 0;
for (int i = 0, j = 0; i < n; ++i)
{
sum += w[a[i]];
if (sum > upp) sum -= w[a[j++]];
if (j > i) break;
if (low <= sum && sum <= upp) return vector<int>(a.begin() + j, a.begin() + i + 1);
}
return 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... |