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 1193. Queue at the Exam

I don't quite understand the meaning!please help!
Posted by Ural_Happy New Year! 7 May 2003 18:49
If the input is
4
100 10 120
70 40 150
99 15 400
400 50 160
what's the output and why?

this is my code:
--------------------------
program t1193;
type types=record
           b:longint;
           l:longint;
           e:longint;
           end;
var n,i,start:longint;
    t:array[0..100]of types;
procedure qsort(l,r:integer);
var j,i,x,y:integer;
begin
     i:=l;j:=r;
     x:=t[(l+r) div 2].b;
     repeat
           while t[i].b<x do inc(i);
           while t[j].b>x do dec(j);
           if i<=j then
              begin
              y:=t[i].b; t[i].b:=t[j].b; t[j].b:=y;
              y:=t[i].e; t[i].e:=t[j].e; t[j].e:=y;
              y:=t[i].l; t[i].l:=t[j].l; t[j].l:=y;
              inc(i);dec(j);
              end;
     until i>j;
     if l<j then qsort(l,j);
     if i<r then qsort(i,r);
end;
begin
     readln(n);
     for i:=1 to n do
         readln(t[i].b,t[i].l,t[i].e);
     qsort(1,n);
     start:=t[1].b;
     for i:=1 to n do
         begin
         start:=start+t[i].l;
         if t[i+1].b>start then start:=t[i+1].b;
         end;
     start:=start-t[n].e;
     if start>0 then writeln(start)
                else writeln('0');
end.
Re: I don't quite understand the meaning!please help!
Posted by MSDN 21 Aug 2007 14:01
In the problem write T1<=T3 and you write "400 50 160" it is wrong. sorry my english is very bad