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 long long
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<int> ind(n);
for (int i = 0; i < n; i++)
ind[i] = i;
sort(ind.begin(), ind.end(), [&](int x, int y){
return (w[x] < w[y]);
});
vector<int> answer;
ll sum = 0;
int pos = 0;
for (int i = 0; i < n; i++){
sum += w[ind[i]];
while (sum > u)
sum -= w[ind[pos++]];
if (sum >= l){
for (int j = pos; j <= i; j++)
answer.push_back(ind[j]);
return answer;
}
}
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... |