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;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = (int) w.size();
for (int i = 0; i < n; i++) {
if (w[i] >= l && w[i] <= u) {
return {i};
}
}
vector<pair<int, int>> nums;
for (int i = 0; i < n; i++) {
if (w[i] <= u) {
nums.emplace_back(w[i], i);
}
}
sort(nums.rbegin(), nums.rend());
int cur = 0;
vector<int> res;
for (auto& [x, y] : nums) {
if (cur + x > u) {
continue;
}
cur += x;
res.push_back(y);
}
return res;
}
# | 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... |