记录编号 12860 评测结果 AAAAAAAAAA
题目名称 护卫队 最终得分 100
用户昵称 GravatarAchilles 是否通过 通过
代码语言 Pascal 运行时间 0.162 s
提交时间 2009-09-22 11:18:20 内存使用 7.79 MiB
显示代码纯文本
program convoy;
var
  i,j:longint;
  m,l,n,temp:int64;
  car:array[1..1000]of record
    w,s:int64;
  end;
  mins:array[0..1000,0..1000] of int64;
  sz:array[0..1000]of extended;
  w:array[0..1000]of int64;
begin
  assign(input,'convoy.in');
  assign(output,'convoy.out');
  reset(input);
  rewrite(output);
  readln(m,l,n);
  w[0]:=0;
  for i:=1 to n do
  begin
    readln(car[i].w,car[i].s);
    w[i]:=w[i-1]+car[i].w;
  end;
  for i:=1 to n do
    for j:=i to n do
      mins[i,j]:=9223372036854775807;
  for i:=1 to n do
    mins[i,i]:=car[i].s;
  for i:=2 to n do
  begin
    for j:=1 to n-i+1 do
    begin
      if mins[j,j+i-2]>car[j+i-1].s then mins[j,j+i-1]:=car[j+i-1].s else mins[j,j+i-1]:=mins[j,j+i-2];
    end;
  end;
  for i:=1 to n do
  begin
    sz[i]:=1.1e4932;
  end;
  sz[0]:=0;
  for i:=1 to n do
  begin
    for j:=0 to i-1 do
    begin
      temp:=0;
      temp:=w[i]-w[j];
      if temp<=m then begin
        if l/mins[j+1,i]*60<=sz[i-1]-sz[j] then begin
          sz[i]:=sz[i-1];
          break;
        end
        else begin
          if sz[j]+l/mins[j+1,i]*60<sz[i] then
            sz[i]:=sz[j]+l/mins[j+1,i]*60;
        end;
      end;
    end;
  end;
  writeln(sz[n]:0:1);
  close(input);
  close(output);
end.