Editorial for LCC '24 Contest 3 J4 - Shipments


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Iaminnocent4298

Subtask 1

We can simply bubble sort through each pair of ships on the list.

Subtask 2

We can take advantage of the ability to sort objects by their attributes in built-in custom sort.

Consider an object containing the following attributes: month, day, hour, minute, and number, indicating the ship number.

We can simply then create a custom sort that will compare the months, then the days, then the hours, then the minutes, in that order.

Then, loop through all ships and print out the number.


Comments

There are no comments at the moment.