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;
const long long INF = 1e15;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<long long, int>> v;
int n = (int)w.size();
for (int i = 0; i < n; ++i)
v.push_back({w[i], i});
v.push_back({INF, n});
sort(v.begin(), v.end());
long long pref = 0, suff = 0;
for (int i = 0; i < n; ++i) {
pref += v[i].first;
suff += v[n - 1 - i].first;
if (pref <= u && suff >= l) {
vector<int> res;
for (int j = i; j < n; ++j) {
if (pref >= l) {
for (int k = j - i; k <= j; ++k)
res.push_back(v[k].second);
return res;
}
pref += v[j + 1].first - v[j - i].first;
}
}
}
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... |