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;
pair<int, int> a[200002];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> r;
long long L, U;
int i, j, k, n;
n = w.size();
for (i = 0; i < n; i++) {
a[i].first = w[i];
a[i].second = i;
}
sort(a, a + n);
L = U = 0;
for (i = 0; i < n; i++) {
L += a[i].first;
U += a[n - i - 1].first;
if (L <= u && l <= U) break;
}
if (i == n) return r;
for (j = 0; L < l; j++) {
L -= a[j].first;
L += a[j + i + 1].first;
}
for (k = 0; k <= i; k++) r.push_back(a[j + k].second);
return r;
}
# | 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... |