题目描述
Problem Description
Today, Katsusando-kun has his favorite foods lined up in front of him, totaling $ N $ types. Katsusando-kun decided to determine the strongest food from these.
Through Katsusando-kun's unique investigation, it was found that the health of food $ i $ is $ A_i $ and its attack power is $ B_i $. When food $ i $ fights with food $ j $, the outcome is determined by the following procedure. (Please also refer to the input/output examples.)
- Each food attacks the other. The health of food $ i $ decreases by $ B_j $, and the health of food $ j $ decreases by $ B_i $.
- A food whose health drops to $ 0 $ or below becomes incapacitated.
- If neither food is incapacitated, return to step 1.
- If both foods are incapacitated, it's a draw; if only one is incapacitated, the other wins.
Katsusando-kun decided that the strongest food is the one that can win against any other food. Determine which food is the strongest.
Input Format
The input is given from the standard input in the following format:
$ N $ $ A_1 $ $ B_1 $ $ A_2 $ $ B_2 $ $ : $ $ A_N $ $ B_N $
Output Format
Output the number of the strongest food. If there is no strongest food, output -1 instead.
Sample Input and Output
Sample Input #1
3
7 3
9 2
2 5
Sample Output #1
1
Sample Input #2
2
999999999 1000000000
1 999999999
Sample Output #2
-1
Sample Input #3
2
999999999 1
1000000000 1
Sample Output #3
2
Sample Input #4
3
100 17
171 10
91 19
Sample Output #4
-1
Notes/Hints
Constraints
The input satisfies the following conditions:
- $1 \leq N \leq 2 \times 10^5$
- $1 \leq A_i, B_i \leq 10^9$
- All input values are integers.
Sample Explanation 1
Food $ 1 $ can win against both other foods, making it the strongest food. - When food $ 1 $ fights food $ 2 $, the following happens: 1. Initially, the health of both foods is $ 7, 9 $. 2. After mutual attacks, their health becomes $ 5, 6 $. 3. After mutual attacks, their health becomes $ 3, 3 $. 4. After mutual attacks, their health becomes $ 1, 0 $. 5. Only food $ 2 $ is incapacitated, so food $ 1 $ wins. - When food $ 1 $ fights food $ 3 $, the following happens: 1. Initially, the health of both foods is $ 7, 2 $. 2. After mutual attacks, their health becomes $ 2, -1 $. 3. Only food $ 3 $ is incapacitated, so food $ 1 $ wins.
Sample Explanation 2
When food $ 1 $ fights food $ 2 $, both foods become incapacitated after the first attack, resulting in a draw. Therefore, there is no strongest food.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分