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;
typedef long long ll;
#define ssize(x) (int)size(x)
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<pair<int, int>> pairs;
for (int i = 0; i < ssize(w); i++)
pairs[i] = {w[i], i};
sort(pairs.begin(), pairs.end());
vector<ll> sum(ssize(w) + 1);
for (int i = 0; i < ssize(w); i++)
sum[i + 1] = sum[i] + pairs[i].first;
for (int i = 1; i <= ssize(w); i++) {
int where = lower_bound(sum.begin(), sum.begin() + i, sum[i] - u) - sum.begin();
if (sum[i] - sum[where] >= l) {
vector<int> wyp;
for (int j = where + 1; j <= i; j++)
wyp.push_back(pairs[i].second);
return wyp;
}
}
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... |