比赛 Asm.Def战记之圣地亚哥“杯2015 评测结果 WWWWWWWWWW
题目名称 Asm.Def的枪榴弹 最终得分 0
用户昵称 Ten.X 运行时间 0.002 s
代码语言 Pascal 内存使用 0.18 MiB
提交时间 2015-10-31 10:34:26
显示代码纯文本
var max,n,i,j,k,k0,k1,k2:longint;
a,b,c,d,e:array[0..500]of longint;
dp:array[0..500]of longint;
sum:array[1..14]of longint;
procedure deal;
var temp,xx:longint;
begin
randomize;
repeat
xx:=random(n)+1;
until (xx>=1) and(xx<=n);
temp:=sum[xx];sum[xx]:=sum[1];sum[1]:=temp;
end;
begin
assign(input,'asm_grenade.in');
assign(output,'asm_grenade.out');
reset(input);
rewrite(output);
fillchar(dp,sizeof(dp),0);
max:=-maxlongint;
read(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]);
read(k0,k1,k2);
for i:=1 to n do sum[i]:=i;
deal;
dp[0]:=k0+k1+k2;
for i:=1 to n do
for j:=k0+k2+k1 downto a[sum[i]]+b[sum[i]] do
for k:=k1+k2+k0 downto b[sum[i]]+a[sum[i]] do
if (j-a[sum[i]]-b[sum[i]]>=0)and(k-b[sum[i]]-a[sum[i]]>=0)then
if dp[j+k]<dp[j-a[sum[i]]+k-b[sum[i]]]+d[sum[i]]+c[sum[i]]+e[sum[i]] then
dp[j+k]:=dp[j-a[sum[i]]+k-b[sum[i]]]+d[sum[i]]+c[sum[i]]+e[sum[i]];
for i:=0 to 2*(k1+k2+k0) do
if dp[i]>max then max:=dp[i];
write(dp[i]);
close(input);
close(output);
end.