请问哪里错了
#include\"stdio.h\"
#include\"string.h\"

struct in{
	int n;
	int w[1005];
	int p;
	int all;
	in()
	{
		p=0;
		all=0;
	}
}f[20];

int dp[20][10005];

int p[1005],v[1005],ans;
int boo[1005];
int main()
{
	int N,M;
	int ii,jj,kk;
	int i,j,k,nf,x;
	while(scanf(\"%d%d\",&N,&M)!=EOF)
	{
		for(i=1;i<=N;i++)
			scanf(\"%d\",&p[i]);
		for(i=1;i<=N;i++)
			scanf(\"%d\",&v[i]);
		scanf(\"%d\",&nf);
		memset(boo,0,sizeof(boo));
		for(i=1;i<=nf;i++)
		{
			scanf(\"%d\",&f[i].n);
			for(j=0;j<f[i].n;j++)
			{
				scanf(\"%d\",&f[i].w[j]);
				boo[f[i].w[j]]=1;
				f[i].p+=p[f[i].w[j]];
				f[i].all+=v[f[i].w[j]];
			}
			scanf(\"%d\",&x);
			f[i].all+=x;
		}
	for(i=0;i<=M;i++)
		dp[0][i]=-1;
			dp[0][0]=0;
		for(i=1;i<=N;i++)
		{
			if(boo[i]==0)
			{
				for(j=M;j>=0;j--)
				{
					if(dp[0][j]!=-1&&j+p[i]<=M)
					{
						if(dp[0][j]+v[i]>dp[0][j+p[i]])
							dp[0][j+p[i]]=dp[0][j]+v[i];
					}
				}
			}
		}
		for(i=1;i<=nf;i++)
		{
			for(j=0;j<=M;j++)
				dp[i][j]=dp[i-1][j];
			for(j=0;j<f[i].n;j++)
			{
				ii=f[i].w[j];
				for(k=M;k>=0;k--)
				{
					if(dp[i][k]!=-1&&k+p[ii]<=M)
					{
						if(dp[i][k]+v[ii]>dp[i][k+p[ii]])
							dp[i][k+p[ii]]=dp[i][k]+v[ii];
					}
				}
			}
				for(k=M;k>=0;k--)
				{
					if(dp[i-1][k]!=-1&&k+f[i].p<=M)
					{
						if(dp[i-1][k]+f[i].all>dp[i][k+f[i].p])
							dp[i][k+f[i].p]=dp[i-1][k]+f[i].all;
					}
				}
		}
		ans=0;
		for(i=0;i<=M;i++)
			if(dp[nf][i]>ans)
				ans=dp[nf][i];
			printf(\"%d\\n\",ans);
	}
}
想实现什么结果?
© 2015 HUST ACMICPC TEAM. All Right Reserved.