This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include "bits/stdc++.h"
#include "molecules.h"
using namespace std;
using ll = long long;
vector<int> find_subset(int l, int u, vector<int> w) {
srand(time(0));
int n = (int)w.size();
ll sum = 0;
for (int i=0; i<n; i++) {
sum += (ll)w[i];
}
if (sum == u) {
vector<int> res;
for (int i=0; i<n; i++) {
res.push_back(i);
}
return res;
}
if (sum < l) {
vector<int> ans;
return ans;
}
for (int i=0; i<10000; i++) {
set<int> s;
for (int j=0; j<n; j++) {
int r = rand()%n;
s.insert(r);
}
sum = 0;
for (auto &e:s) {
sum += (ll)w[e];
}
if (l <= sum && sum <= u) {
vector<int> res;
for (auto &e:s) {
res.push_back(e);
}
return res;
}
}
vector<int> emp;
return emp;
}
# | 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... |