#include<bits/stdc++.h>
#define debug(args...) //fprintf(stderr,args)
using namespace std;
const int MAXN=11234;
int resp[MAXN],kn[MAXN];
int find_subset(int l,int u,int w[],int n,int result[])
{
for(int i=0;i<MAXN;i++)
{
kn[i]=-1;
}
kn[0]=-2;
for(int i=0;i<n;i++)
{
for(int j=MAXN-1;j>=w[i];j--)
{
if(kn[j-w[i]]!=-1 && kn[j]==-1)kn[j]=i;
}
}
int val=-1;
for(int i=l;i<=u;i++)
{
if(kn[i]!=-1)val=i;
debug("%d %d\n",i,kn[i]);
}
if(val==-1)return 0;
int cont=0;
while(val>0)
{
result[cont]=kn[val];
val-=w[kn[val]];
cont++;
debug("oi %d %d %d\n",kn[val],w[kn[val]],val);
}
for(int i=0;i<cont;i++)resp[i]=result[i];
return 0;
}
/*int w[MAXN];
int v[MAXN];
int main()
{
int l,u,n;
scanf("%d %d %d",&l,&u,&n);
for(int i=0;i<n;i++)scanf("%d",&w[i]);
find_subset(l,u,w,n,v);
for(int i=0;i<n;i++)printf("%d\n",w[resp[i]]);
}*/
Compilation message
/tmp/ccOcn3tK.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status