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;
vector <int> find_subset(int L, int U, vector <int> w) {
int n = w.size();
vector <pair <int, int>> weights;
for(int i = 0; i < n; i++) {
weights.emplace_back(w[i], i);
}
sort(weights.begin(), weights.end());
long long sum = 0;
for(int l = 0, r = 0; l < n; l++) {
while(r < n and sum <= U) {
sum += weights[r].first;
r++;
}
if(L <= sum and sum <= U) {
vector <int> ans;
for(int i = l; i < r; i++) {
ans.push_back(weights[i].second);
}
return ans;
}
sum -= weights[l].first;
}
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... |