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;
vector<int> find_subset(int l, int u, vector<int> w) {
int sum = 0, i = 0, n = (int)w.size();
vector<pair<int, int>> a(n);
for(int i = 0; i < n; i++) a[i] = {w[i], i};
sort(a.begin(), a.end());
vector<int> v;
while(i < n && sum < u-a[i].first) v.push_back(a[i].second), sum += a[i++].first;
if(sum >= l) return v;
for(int j = 1; j <= i; j++){
sum -= a[i-j].first;
sum += a[n-j].first;
v[i-j] = a[n-j].second;
if(sum >= l) return v;
}
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... |