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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int,int>> wp(n);
for (int i = 0; i < n; i++)
wp[i] = {w[i], i};
mt19937 rnd(239);
for(int kk = 0; kk < 1000; kk++) {
shuffle(wp.begin(), wp.end(), rnd);
int sum = 0, i = 0;
while (i < n && sum < l)
sum += wp[i++].first;
if (l <= sum && sum <= u) {
vector<int> res(i);
for (int j = 0; j <= i; j++)
res[j] = wp[j].second;
return res;
}
}
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... |