比赛 |
Asm.Def战记之圣地亚哥“杯2015 |
评测结果 |
|
题目名称 |
Asm.Def的枪榴弹 |
最终得分 |
0 |
用户昵称 |
BYVoid |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2019-10-23 19:12:46 |
显示代码纯文本
#include<cstdio>
#define re register
using namespace std;
inline int read(){
int s=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
s=(s<<1)+(s<<3)+ch-'0';
ch=getchar();
}
return s*f;
}
int max(int x,int y){
return x>y?x:y;
}
struct R{
int a,b,c,d,e;
}room[20];
int n,k0,k1,k2,ans,tot;
bool check[20];
void search(int k0now,int k1now,int k2now,int tim){
//if(tot>100000000)return;
if(tim>n)return;
ans=max(k0now+k1now+k2now,ans);
for(re int i=1;i<=n;++i){
// ++tot;
if(!check[i]){
//if(k0now+k1now+k2now>=room[i].a+room[i].b && (k0now+k2now)>=room[i].a && (k1now+k2now)>=room[i].b){
// check[i]=1;
int kk0=k0now;
int kk1=k1now;
int kk2=k2now;
if(kk0>=room[i].a){
kk0-=room[i].a;
}
else {
kk2-=(room[i].a-kk0);
kk0=0;
}
if(kk1>=room[i].b){
kk1-=room[i].b;
}
else {
kk2-=(room[i].b-kk1);
kk1=0;
}
if(kk0>=0 && kk1>=0 && kk2>=0){
check[i]=1;
kk0+=room[i].c;
kk1+=room[i].d;
kk2+=room[i].e;
search(kk0,kk1,kk2,++tim);
check[i]=0;
}
//}
}
}
}
int main()
{
freopen("asm_grenade.in","r",stdin);
freopen("asm_grenade.out","w",stdout);
n=read();
for(re int i=1;i<=n;++i) room[i].a=read();
for(re int i=1;i<=n;++i) room[i].b=read();
for(re int i=1;i<=n;++i) room[i].c=read();
for(re int i=1;i<=n;++i) room[i].d=read();
for(re int i=1;i<=n;++i) room[i].e=read();
k0=read();
k1=read();
k2=read();
search(k0,k1,k2,1);
printf("%d\n",ans);
return 0;
}
/*
14
1 8 3 5 3 6 3 6 3 5 7 4 4 6
2 4 6 8 4 7 5 5 3 6 3 7 5 7
3 4 6 3 5 7 3 8 5 7 3 2 2 1
3 5 7 8 4 4 3 5 7 4 3 2 6 8
2 5 6 7 5 2 3 6 3 6 3 6 3 6
9 9 9
*/
/*
14
1 3 3 3 3 1 3 6 3 2 1 3 2 1
2 4 2 2 1 7 3 1 3 2 3 1 5 2
3 4 6 3 5 7 3 8 5 7 3 2 2 1
3 5 7 8 4 4 3 5 7 4 3 2 6 8
2 5 6 7 5 2 3 6 3 6 3 6 3 6
9 9 9
*/