#P8832. Volunteer Contribution Ranking
Volunteer Contribution Ranking
Volunteer Contribution Ranking
You are given n volunteers, each of whom is responsible for cleaning activities. The i-th volunteer has a working time \(t_i\) and a task difficulty coefficient \(k_i\). The contribution of the i-th volunteer is defined as:
\(c_i = k_i \times t_i\)
Your task is to sort the volunteers in descending order by their contribution \(c_i\). In case of a tie, the volunteer with the longer working time \(t_i\) should come first. If both contribution and working time are the same, the volunteer with the smaller index (1-indexed) comes first.
inputFormat
The first line contains a single integer n representing the number of volunteers. Each of the next n lines contains two integers ti and ki separated by a space, which denote the working time and the difficulty coefficient of the i-th volunteer respectively.
outputFormat
Output a single line containing n integers. These integers are the indices of the volunteers (1-indexed) sorted according to the criteria described above.
sample
3
2 3
3 2
2 2
2 1 3