比赛 20110724 评测结果 AWTTTTTTTT
题目名称 准备工作 最终得分 10
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-07-24 11:27:03
显示代码纯文本
program zhunbeigongzuo;
var
  n,i:longint;
  p,r,d:array[1..100]of longint;
  biaozhi:array[1..100]of boolean;
  min,max,s:longint;
  jilu,a:array[1..100]of longint;
function da(x,y:longint):longint;
begin
  if x>y then
    da:=x
  else
    da:=y
end;
procedure sousuo(k,time:longint);
var
  i:longint;
begin
  if k>n then
  begin
    max:=0;
    for s:=1 to n do
    begin
      if jilu[s]+p[a[s]]-d[a[s]]>max then
        max:=jilu[s]+p[a[s]]-d[a[s]]
    end;
    if max<min then
      min:=max
  end
  else
  begin
    for i:=1 to n do
    begin
      if biaozhi[i] then
      begin
        a[k]:=i;
        jilu[k]:=da(time,r[i]);
        biaozhi[i]:=false;
        sousuo(k+1,jilu[k]+p[i]);
        biaozhi[i]:=true
      end
    end
  end
end;
begin
  assign (input,'preparation.in');
  reset (input);
  assign (output,'preparation.out');
  rewrite (output);
  readln (n);
  while n<>0 do
  begin
    for i:=1 to n do
      read (p[i]);
    readln;
    for i:=1 to n do
      read (r[i]);
    readln;
    for i:=1 to n do
      read (d[i]);
    readln;
    for i:=1 to n do
      biaozhi[i]:=true;
    min:=maxlongint;
    sousuo(1,0);
    writeln (min);
    readln(n)
  end;
  close (input);
  close (output)
end.