grandpabernie - bradendubois/competitive-programming GitHub Wiki

Grandpa Bernie

ID: grandpabernie

Difficulty: 2.8

CPU Time: 1 second

Memory: 1024 MB

Solution

For this, take in all the n trips, where a country is mapped to a list of years; push the given year onto the list for the given country. After this, simply sort all the years. Then, when given a year and trip number, the country's list of years should have index i-1 correspond to the trip i.