LCC '24 Contest 3 J4 - Shipments

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

"The Book Vault Canal" is a canal that allows ships to travel between the Oldmarket and Spawnlands regions of Payneful S3. The canal is crucial to connect two major bodies of water, hence the amount of ships that pass through each day. However, one day, Bob and his friends decided to rudely waddle across the canal, stopping ships for minutes! Now, there is a huge backlog of N ships waiting to cross the canal. You don't know which ships came first, and you are about to have a panic attack when you realize you have a megaphone and a ship list at your disposal. You can call out ship numbers, but you need to call them in the order that they came! Please, determine which order the ships should cross the canal!

Input Specifications

The first line will contain the integer, N. The next N lines will contain S_i, the ship number of the ith ship, and T_i, the time at which the ith ship should cross the canal.

All times will be written in the form DD/MM HH:MM (that is day, then month, then hour, then minute), with the time being in 24-hour format. Assume all dates occur during the same year (in other words, January 1 will always come before December 31.)

Output Specifications

Output N lines, with each line containing a ship number. The ship numbers should be printed in order of first to enter the canal, to last to enter the canal.

Subtasks

1 \leq N \leq 10^6

All times are distinct, valid times.

All ship numbers are guaranteed to be positive, distinct, and less than 10^9.

Subtask 1 [30%]

1 \leq N \leq 10^3

Subtask 2 [70%]

No additional constraints.

Sample Input

4
801248 30/04 11:27
195826 30/04 15:18
444187 01/05 08:15
68253 30/04 00:54

Sample Output

68253
801248
195826
444187

Explanation for Sample Output

Remember that a 24-hour clock goes from 00:00 to 23:59.


Comments

There are no comments at the moment.