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;
typedef long long int ll;
#define debug(x) cerr << #x << " = " << (x) << endl
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int, int>> arr(n);
for (int i = 0; i < n; i++) {
arr[i] = { w[i], i };
}
sort(arr.begin(), arr.end());
ll sum = 0;
vector<int> ans;
int i = 0;
for (; i < n; i++) {
if (sum + arr[i].first >= l) break;
sum += arr[i].first;
ans.push_back(arr[i].second);
}
for (; i < n; i++) {
if (sum + arr[i].first >= l) {
sum += arr[i].first;
ans.push_back(arr[i].second);
break;
}
}
// debug(sum);
if (sum >= l && sum <= u) {
return ans;
}
return vector<int>(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... |