比赛 Asm.Def战记之圣地亚哥“杯2015 评测结果 AAAAAAATTT
题目名称 Asm.Def的枪榴弹 最终得分 70
用户昵称 真香警告 运行时间 3.744 s
代码语言 C++ 内存使用 13.67 MiB
提交时间 2019-10-23 18:56:57
显示代码纯文本
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
 
const int maxn=200;
int n;
int ans;
int vis[maxn];
 
struct room{
	int robot;
	int boom;
	int Aaimo;//甲类弹 kill robot 
	int Baimo;//乙类弹 kill boom 
	int Caimo;//丙类弹 kill both 
	int wearth;
}r[maxn];
 
struct preson{
	int Aaimo;
	int Baimo;
	int Caimo;
}p;
 
inline int read(){
	int w=1,x=0,ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') w=-1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return w*x;
}
 
void dfs(int cnt,int A,int B,int C){
	if(cnt>n) return;
	int sum=0;
	sum=A+B+C;
	ans=max(ans,sum);
	for(register int i=1;i<=n;i++){
		if(vis[i]) continue;
//		if(A+B+C+r[i].wearth<ans) continue;
		vis[i]=1;
		if(A>=r[i].robot&&B>=r[i].boom) dfs(cnt+1,A-r[i].robot+r[i].Aaimo,B-r[i].boom+r[i].Baimo,C+r[i].Caimo);
		else{
			if(A>=r[i].robot&&B<r[i].boom&&C>=(r[i].boom-B)) dfs(cnt+1,A-r[i].robot+r[i].Aaimo,r[i].Baimo,C-(r[i].boom-B)+r[i].Caimo);
			if(A<r[i].robot&&B>=r[i].boom&&C>=(r[i].robot-A)) dfs(cnt+1,r[i].Aaimo,B-r[i].boom+r[i].Baimo,C-(r[i].robot-A)+r[i].Caimo);
			if(A<r[i].robot&&B<r[i].boom&&C>=(r[i].robot-A)+(r[i].boom-B)) dfs(cnt+1,r[i].Aaimo,r[i].Baimo,C-(r[i].robot-A)-(r[i].boom-B)+r[i].Caimo);
		}
		vis[i]=0;
	}
}
 
int main(){
	freopen("asm_grenade.in","r",stdin);
	freopen("asm_grenade.out","w",stdout);
	n=read();
	for(register int i=1;i<=n;i++) r[i].robot=read();
	for(register int i=1;i<=n;i++) r[i].boom=read();
	for(register int i=1;i<=n;i++) r[i].Aaimo=read();
	for(register int i=1;i<=n;i++) r[i].Baimo=read();
	for(register int i=1;i<=n;i++) r[i].Caimo=read();
	//for(register int i=1;i<=n;i++) r[i].wearth=(r[i].Aaimo+r[i].Baimo+r[i].Caimo)-(r[i].robot-r[i].boom);
	p.Aaimo=read(),p.Baimo=read(),p.Caimo=read();
	dfs(0,p.Aaimo,p.Baimo,p.Caimo);
	cout<<ans<<'\n';
	return 0;
}