PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000031. Xếp hạng xác suất (Standings)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xếp hạng xác suất (Standings)
Standings
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
There are people. Person has successes and failures. The success rate is . Sort indices by decreasing rate, breaking ties by smaller index.
Input
The first line contains . Each of the next lines contains .
Output
Print the indices in the required order.
Constraints
- .
- for .
- for every .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): Full constraints.
Examples
Input
3
1 3
3 1
2 2
Output
2 3 1
Explanation
The sample follows the ordering rule described in the Vietnamese explanation and produces the shown optimum.