GlobeX Cup '19 J3 - Codex

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Alex is creating a codex (list), S, of all the planets known in the universe and their sizes. However, since there are so many of them, he wants to remove all planets such that |SiSj|K, where i and j are arbitrary indices.

Input Specification

The first line will contain two integers, N (1N105) and K (1K1015).

The next N lines will each contain a string, P (1|P|100), the planet's name, followed by a space, followed by an integer, S (1S1015), the diameter in kilometers of the planet.

Output Specification

The output will contain the space separated names of all the planets in Alex's codex, in lexicographical order.

Sample Input

Copy
4 2
Planet 100
AnotherPlanet 50
3rdPlanet 2
4thPlanet 3

Sample Output

Copy
AnotherPlanet Planet

Comments

There are no comments at the moment.