#K36742. Employee Promotion Order
Employee Promotion Order
Employee Promotion Order
You are given a list of employees. Each employee is represented by two integers: an employee ID and a rating. Your task is to determine the promotion order according to the following rules:
- Employees with a higher rating are promoted before those with a lower rating.
- If two employees have the same rating, the employee with the smaller ID is promoted first.
This can be expressed mathematically as follows: for two employees with ratings \(r_1\) and \(r_2\) and IDs \(id_1\) and \(id_2\), employee 1 comes before employee 2 if either \(r_1 > r_2\) or \(r_1 = r_2\) and \(id_1 < id_2\). The output should be the list of employee IDs in the order of their promotion.
inputFormat
The input is read from stdin
and has the following format:
- The first line contains an integer \(n\) representing the number of employees.
- The next \(n\) lines each contain two space-separated integers: the employee ID and the employee's rating.
outputFormat
Print the employee IDs in their promotion order on a single line, separated by a single space. The output is written to stdout
.
5
1 80
2 90
3 80
4 90
5 85
2 4 5 1 3