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>
#define ll int
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<ll> w) {
int n = w.size();
pair <ll, int> a[n];
for (int i = 0; i < n; ++ i) {
if (l <= w[i] && w[i] <= u) {
return vector <int>(1, i + 1);
}
a[i].first = w[i];
a[i].second = i;
}
sort(a, a + n);
ll sum = 0;
vector <int> ans;
for (int i = n - 1; i >= 0; -- i) {
if (a[i].first > u) continue;
sum += a[i].first;
ans.push_back(a[i].second);
if (l <= sum && sum <= u) {
sort(ans.begin(), ans.end());
return ans;
}
}
return vector <ll> (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... |