记录编号 |
455389 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[SYOI 2015] Asm.Def的枪榴弹 |
最终得分 |
100 |
用户昵称 |
Shirry |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
2.302 s |
提交时间 |
2017-10-01 22:57:18 |
内存使用 |
183.41 MiB |
显示代码纯文本
#include<cstdio>
#include<map>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=15;
int n,k0,k1,k2,ans,A[maxn],B[maxn],C[maxn],D[maxn],E[maxn];
bool vis[maxn];
map<int,bool>s[200][200][200];
void read(){
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",&C[i]);
for(int i=1;i<=n;i++)scanf("%d",&D[i]);
for(int i=1;i<=n;i++)scanf("%d",&E[i]);
scanf("%d%d%d",&k0,&k1,&k2);
}
int get(){//喵啊
int ans=0;
for(int i=1;i<=n;i++){
ans<<=1,ans+=vis[i];
}
return ans;
}
void dfs(int a,int b,int c,int now){
int id=get();
if(s[a][b][c][id])return;
s[a][b][c][id]=1;
if(now>ans)ans=now;
for(int i=1;i<=n;i++){
if(vis[i])continue;
int ta=a-A[i],tb=b-B[i],tc=c,tmp=0;
if(ta<0)tc+=ta,tmp-=ta,ta=0;
if(tb<0)tc+=tb,tmp-=tb,tb=0;
if(tc<0)continue;
tmp-=E[i];
if(C[i]+D[i]<tmp)continue;
ta+=C[i],tb+=D[i],tc+=E[i];
if(ta<=a&&tb<=b&&tc<=c)continue;
vis[i]=1;
dfs(ta,tb,tc,ta+tb+tc);
vis[i]=0;
}
}
int main(){
freopen("asm_grenade.in","r",stdin);
freopen("asm_grenade.out","w",stdout);
read();
int now=k0+k1+k2;
ans=now;
dfs(k0,k1,k2,now);
printf("%d",ans);
return 0;
}