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 <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int u, int v, vector<int> w) {
int n = w.size();
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](const int &a, const int &b) {
return w[a] < w[b];
});
long long sumL = 0, sumR = 0;
for (int i = 1; i <= n; i++) {
sumL += w[ord[i - 1]];
sumR += w[ord[n - i]];
if (max(1ll * u, sumL) <= min(1ll * v, sumR)) {
vector<int> res;
for (int j = 0; j < i; j++) {
if (sumL < u) {
sumL -= w[ord[j]];
sumL += w[ord[n - 1 - j]];
res.push_back(ord[n - 1 - j]);
} else {
res.push_back(ord[j]);
}
}
return res;
}
}
return vector<int>(0);
}
# | 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... |