# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200873 | oofsauce | Detecting Molecules (IOI16_molecules) | C++14 | 8 ms | 632 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>
using namespace std;
int l;
int u;
vector<int> weights;
vector<vector<bool>> visited;
vector<int> ans;
bool recurse(int idx, int w) {
if(w <= u && w >= l) return true;
if(idx >= weights.size()) return false;
if(visited[idx][w]) return false;
if(recurse(idx+1, w)) return true;
if(recurse(idx+1, w+weights[idx])) {
ans.push_back(idx);
return true;
}
visited[idx][w] = true;
return false;
}
vector<int> find_subset(int l_, int u_, vector<int> weights_) {
l = l_;
u = u_;
weights = weights_;
visited.resize(weights.size()+5, vector<bool>(l+5,false));
recurse(0,0);
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... |