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;
const int nax = 1000;
int par[nax * 10 + 1];
bool dp[nax * 10 + 1];
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
dp[0] = 1;
for(int i=0; i<n; ++i) {
for(int j=nax*10; j-w[i]>=0; --j) {
if(dp[j-w[i]] && !dp[j]) {
dp[j] = 1;
par[j] = i;
}
}
}
int st = -1;
for(int x=l; x<=u; ++x) {
if(dp[x]) {
st = x;
break;
}
}
vector<int>ret;
if(st==-1) return ret;
while(st!=0) {
ret.push_back(par[st]);
st -= w[par[st]];
}
return ret;
}
# | 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... |