#C10626. Leaderboard Update
Leaderboard Update
Leaderboard Update
Given an array of integers \(p_0, p_1, \ldots, p_{n-1}\) where the index represents the runner's ID and the value \(p_i\) represents the runner's current position, your task is to generate a leaderboard of the top \(k\) runners. The leaderboard is created by sorting the runners in ascending order of their positions (i.e. a runner with a lower position value ranks higher). Print the runner IDs corresponding to the top \(k\) positions.
Note: The input is provided via standard input and the output should be printed to standard output. Runner IDs are zero-indexed.
inputFormat
The first line of the input contains an integer \(n\), representing the number of runners. The second line contains \(n\) space-separated integers representing the race positions. The third line contains an integer \(k\), representing the number of top runners to output.
outputFormat
Output the top \(k\) runner IDs in one line separated by a single space. The ordering of the runner IDs should correspond to the sorted order (ascending) of their positions.
## sample5
5 3 1 4 2
3
2 4 1