ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1629. Trip

WA TEST #10
Posted by Javlonbek Qilichev (TATU_UF) 30 Oct 2009 14:49
PLEASE
Re: WA TEST #10
Program contestB;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
ans:integer;

procedure inputdataandsolve;
var
  n,i,j,a,dd:integer;
  min:longint;
  q,d,t:array[1..100] of integer;
  time:array[1..100] of longint;
  s:string[6];
begin
  readln(n);
  ans:=0;
  for i:=1 to n-1 do
  begin
    readln(q[i],d[i],t[i]);
    for j:=1 to q[i] do
    begin
      read(s);
      a:=60*(10*strtoint(copy(s,1,1))+strtoint(copy(s,2,1)));
      a:=a+10*strtoint(copy(s,4,1))+strtoint(copy(s,5,1));
      time[j]:=a+d[i];
    end;
    min:=2000000000;
    for j:=1 to q[i] do
    begin
      while time[j]<ans do        time[j]:=time[j]+1440;

      if min>time[j] then min:=time[j];
    end;
    ans:=min+t[i];
  end;
end;

procedure outputdata;
begin
  writeln(ans);
end;

Begin
  inputdataandsolve;
  outputdata;
End.