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;
vector<int>arr;
int n;
int dp[20005];
int f(int idx,int x,vector<int>vec,int mx,vector<int>weight)
{
if(idx==n)
{
arr=vec;
return 0;
}
if(dp[x]!=-1)return dp[x];
int rez=0;
rez=max(rez, f(idx+1,x,vec,mx,weight));
vector<int>pom;
pom=vec;
pom.push_back(idx);
if(x+weight[idx]<=mx)
rez=max(rez, f(idx+1,x+weight[idx],pom,mx,weight)+weight[idx]);
return dp[x]=rez;
}
vector<int> find_subset(int l, int u, vector<int> w)
{
memset(dp,-1,sizeof dp);
vector<int>v;
queue<int>Q;
n=w.size();
int kol=f(0,0,v,u,w);
if(kol<l)
{
arr.clear();
}
return arr;
}
# | 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... |