比赛 Asm.Def战记之圣地亚哥“杯2015 评测结果 AAWWAWAAWA
题目名称 Asm.Def的枪榴弹 最终得分 60
用户昵称 TAT 运行时间 0.005 s
代码语言 C++ 内存使用 0.60 MiB
提交时间 2015-10-31 11:59:18
显示代码纯文本
#include<cstdio>
using namespace std;
int s[200][200]={0};
int O[200][200]={0};
int a[15]={0},b[15]={0},A[15]={0},B[15]={0},C[15]={0};
int main()
{
	freopen("asm_grenade.in","r",stdin);
	freopen("asm_grenade.out","w",stdout);
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) scanf("%d",&b[i]);
	for (int i=1;i<=n;i++) scanf("%d",&A[i]);
	for (int i=1;i<=n;i++) scanf("%d",&B[i]);
	for (int i=1;i<=n;i++) scanf("%d",&C[i]);
	int k0,k1,k2;
	scanf("%d%d%d",&k0,&k1,&k2);
	s[k0][k1]=k2; 
	for (int j=0;j<=160;j++)
		for (int k=0;k<=160;k++)
			O[j][k]=-1;
	O[k0][k1]=0;
	for (int i=1;i<=n;i++)
	{
		int x=a[i],y=b[i];
		for (int j=0;j<=160;j++)
			for (int k=0;k<=160;k++)
			if (O[j][k]!=-1&&O[j][k]!=i) 
			{
				if (j-x<=0&&k-y<=0&&s[j][k]+j+k-x-y>=0&&s[A[i]][B[i]]<=s[j][k]+(j-x+k-y)+C[i]) 
				{
					s[A[i]][B[i]]=s[j][k]+(j-x+k-y)+C[i];
					O[A[i]][B[i]]=i;
				}
				if (j-x>=0&&k-y<=0&&s[j][k]+k-y>=0&&s[A[i]+j-x][B[i]]<=s[j][k]+(k-y)+C[i]) 
				{
					s[A[i]+j-x][B[i]]=s[j][k]+(k-y)+C[i];
					O[A[i]+j-x][B[i]]=i;
				}
				if (j-x>=0&&k-y>=0&&s[A[i]+j-x][B[i]+k-y]<=s[j][k]+C[i])   
				{
					s[A[i]+j-x][B[i]+k-y]=s[j][k]+C[i];  
					O[A[i]+j-x][B[i]+k-y]=i;
				}
				if (j-x<=0&&k-y>=0&&s[j][k]+j-x>=0&&s[A[i]][B[i]+k-y]<=s[j][k]+(j-x)+C[i]) 
				{
					s[A[i]][B[i]+k-y]=s[j][k]+(j-x)+C[i];
					O[A[i]][B[i]+k-y]=i;
				}
			}
		/*for (int j=0;j<=160;j++)
			for (int k=0;k<=160;k++)
				if (O[j][k]!=-1)printf("%d %d %d\n",j,k,s[j][k]);
		printf("\n\n\n\n\n");*/
	}
	long long max=0;
	for (int i=0;i<=160;i++)
		for (int j=0;j<=160;j++)
			if (O[i][j]!=-1&&i+j+s[i][j]>max) max=i+j+s[i][j];
	printf("%lld",max);
}