# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70971 | RezwanArefin01 | Detecting Molecules (IOI16_molecules) | C++17 | 322 ms | 1680 KiB |
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>
using namespace std;
const int N = 10010;
int need[N];
vector<int> v;
vector<int> find_subset(int l, int u, vector<int> w) {
memset(need, 63, sizeof need);
need[0] = -1;
v.push_back(0);
for(int i = 0; i < w.size(); i++) {
for(int j = 0, sz = v.size(); j < sz; j++) {
int t = v[j] + w[i];
if(t > u) continue;
if(need[t] <= i) continue;
need[t] = i;
v.push_back(t);
}
}
sort(v.begin(), v.end());
auto x = lower_bound(v.begin(), v.end(), l);
if(x == v.end()) return {};
int X = *x;
vector<int> ans;
for(int i = w.size() - 1; i >= 0; i--) {
if(X >= w[i] && need[X - w[i]] < i) {
X -= w[i];
ans.push_back(i);
}
}
return ans;
}
Compilation message (stderr)
# | 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... |