|
|
back to boardDiscussion of Problem 1629. TripRe: 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. |
|
|