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

who can help me to translate it into Chinese,thanks a lot!
Posted by longzeling88 10 Sep 2004 14:55
Re: who can help me to translate it into Chinese,thanks a lot!
Posted by beststu 15 Feb 2006 13:36
Queue to Exam 考试队列
Time Limit: 3 second
Memory Limit: 1000K


Students are passing the exam. Every student know time, when he is ready (T1), number of minutes to complete the exam (T2) and time T3 at which he have to be free already.
学生们参加考试。每人都知道时间安排。T1为准备时间,T2为答卷时间,T3为结束时间。

Times T1 and T3 measured in minutes from the beginning of the exam.
从考试开始,T1,T3就精确计时。

During the contest, there is queue before the examenator. If examenator is busy with another, student waits in queue.
在测试过程中,在主考前,排起了队伍。如果主考忙于应付某个学生,那么其他人只能在队中等待。

It is possible that some students won't be free at T3. Examenator is a kind man, he can shift begining of exam to more early time.
那就有可能有些学生不能在T3时刻结束考试。主考是个和蔼的人,他可以提前考试开始的时间。

You task - write program which calculate amount of minutes to shift the begining of exam.
你的任务是计算考试提前的分钟数。

Input
First line contains amount of students N (1 <= N <= 100). Each of next N lines contains three numbers - T1, T2, T3. 0 <= T1 <= T3 <= 600, 1 <= T2 <= 240. All T1 are distinct.
首行为学生数目N (1 <= N <= 100).以下N行为3个数字:T1,T2,T3。0 <= T1 <= T3 <= 600, 1 <= T2 <= 240.所有的T1都是不同的。

Output
Write answer or 0 (if all students have enough time).
假如所有学生都有足够时间,则输出0。

Sample Input
3
100 10 120
70 40 150
99 15 400
Sample Output
15