比赛 Asm.Def战记之圣地亚哥“杯2015 评测结果 C
题目名称 Asm.Def的枪榴弹 最终得分 0
用户昵称 typhon 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2015-10-31 11:43:11
显示代码纯文本
var a,b,c,d,e:array[0..20] of longint;  v:array[0..20] of boolean;
f:array[0..20] of longint;
n,i,j,k,u,x,y,z,x0,y0,z0,max,maxj:longint;
function can(i:longint):boolean;
var m,n:longint;
begin
 n:=x-a[i];
 m:=y-b[i];
 if n>0 then n:=0;
 if m>0 then m:=0;
 if z+n+m>=0 then exit(true)
 else
 exit(false);
end;
function jz(i:longint):longint;
begin
 exit(c[i]+d[i]+e[i]);
end;


begin
 assign(input,'asm_grenade.in');
 reset(input);
 assign(output,'asm_grenade.out');
 rewrite(outout);
 fillchar(a,sizeof(a),0);
 fillchar(b,sizeof(b),0);
 fillchar(c,sizeof(c),0);
 fillchar(d,sizeof(d),0);
 fillchar(e,sizeof(e),0);
 fillchar(f,sizeof(f),0);
 fillchar(v,sizeof(v),false);
 readln(n);
 for i:=1 to n do
  read(a[i]);
 for i:=1 to n do
  read(b[i]);
 for i:=1 to n do
  read(c[i]);
 for i:=1 to n do
  read(d[i]);
 for i:=1 to n do
  read(e[i]);
 readln(x,y,z);
 f[0]:=x+y+z;
 for i:=1 to n do
  begin
   max:=0;maxj:=0;
   for j:=1 to n do
    if (can(j)) and (jz(j)>max) and not(v[j]) then begin  maxj:=j; max:=jz(j);end;
   x:=x-a[maxj]+c[maxj];
   y:=y-b[maxj]+d[maxj];
   z:=z+e[maxj];
   v[j]:=true;
   f[i]:=f[i-1]+max-a[j]-b[j];
  end;
 max:=0;
 for i:=0 to n do
  if f[i]>max then max:=f[i];
 writeln(max);
end.