# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161522 | kostia244 | Detecting Molecules (IOI16_molecules) | C++14 | 18 ms | 508 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 "molecules.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
vi find_subset(int l, int u, std::vector<int> w) {
bitset<10010> x, y;
vi par(10010, -1);
x.set(0);
for(int i = 0; i < w.size(); i++) {
y = x;
y|=y<<w[i];
x^=y;
int p = x._Find_first();
while(p<=10000) {
par[p]=i;
p = x._Find_next(p);
}
x=y;
}
int sm = x._Find_next(l-1);
if(sm>u)
return {};
vi ans;
while(sm) {
ans.pb(par[sm]);
sm -= w[ans.back()];
}
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... |