ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > IMPC16 Group Contests > задача:


03. 50834 - The train which leaves the first

IMPC16 Group Contests

Старт: 16.янв.2016 в 10:00:00
Финиш: 16.янв.2016 в 14:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 01. 50832 - Rock Paper Scissors Liz...
• 02. 50833 - Min of Odd Positions
• 03. 50834 - The train which lea...
• 11. 50859 - Low performance
• 12. 50860 - Number of Student Certi...
• 13. 50861 - The largest Student Group
• 14. 50862 - Sum of the Pairs
• 15. 50863 - Total Access Cost of a BST
• 21. 50873 - Max Frequency
• 22. 50874 - Apartment Building Adm...
• 23. 50875 - Take m-out

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

The train which leaves the first

You have started working in Tirana central train station. The chief wants a program for adjusting railroad switches. In order to avoid accidents, they need to adjust railroad switches properly. You have the arrival and stay times for the trains.

Question: Write a program that is going to get information for n trains and it will show the train which leave the earliest.

Input specification
In the first line, you will be given an integer: The number of trains(n) where 0 ≤ n ≤ 40000. Then, in the following n lines, you will be given 4 integers

  • arrival time of the train (h, m, s)
  • The time in minutes (k) that the train stays in the station .
where 0 ≤ h ≤ 23, 0 ≤ m and s ≤ 59, and 0 ≤ k ≤ 10,000.
Note: Pay attention that a train might leave some days after.

Output specification:
Show id of the train which leave the earliest. If there are two trains to leave at the same time, show the train with smaller id.

Sample Input I
3
14 30 26 85
14 20 06 115
14 35 24 65
Sample Output I
3

Explanation:

  1. The first train stays 85 minutes and leaves at: 15:55:26
  2. The second train leaves at: 16:15:06
  3. The third train leaves at: 15:40:24
Then the sorted list of trains will 3, 1 and 2.



Для отправки решений необходимо выполнить вход.

www.contester.ru