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 "bits/stdc++.h"
#include "molecules.h"
using namespace std;
std::vector<int> find_subset(int l, int r, std::vector<int> w) {
int n = (int) w.size();
vector<long long> suf(n);
vector<long long> pref(n);
vector<pair<int, int>> a(n);
for (int i = 0; i < n; ++i) {
a[i].first = w[i];
a[i].second = i;
pref[i] = suf[i] = a[i].first;
}
sort(a.begin(), a.end());
auto print = [&](int x, int y) {
vector<int> ans;
for (int i = x; i <= y; ++i) {
ans.push_back(a[i].second);
}
return ans;
};
for (int i = 0; i < n; ++i) {
long long s = 0;
for (int j = i; j < n; ++j) {
s += a[j].first;
if (s >= l && s <= r) {
return print(i, j);
}
}
}
return {};
}
# | 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... |