P27623 [洛谷] [Language Monthly Contest 202407] Eating
普及-
题目描述

Problem Background

Once upon a time, there was a glorious kingdom, and Little A was the king within it. Today, he is going to bestow granaries upon his subjects.

Problem Description

On a street, there are $n$ restaurants. Little A stands at the far left end of this street.

The distance of the $i$-th restaurant from the left end of the street is $a_i$, and the deliciousness value of the dishes it sells is $b_i$.

Little A doesn't want to walk too much but also wants to eat delicious food. Therefore, he defines the attractiveness of a restaurant as $w_i = \frac{b_i}{a_i}$.

Little A wants to know the number of the restaurant with the highest attractiveness. If there are multiple restaurants with the highest attractiveness, you should tell him the number of the one closest to the left end of the street.

Input Format

The first line is an integer $n$, indicating the number of restaurants.
The next $n$ lines each contain two integers, representing the distance $a_i$ of a restaurant from the left end of the street and the deliciousness value $b_i$ of its dishes.

Output Format

Output a single integer, which is the answer.

Sample Input and Output

Sample Input #1

3
1 2
2 4
3 9

Sample Output #1

3

Sample Input #2

3
1 2
2 3
3 4

Sample Output #2

1

Sample Input #3

3
1 1
2 3
4 6

Sample Output #3

2

Notes

Data Size and Constraints

  • For $20\%$ of the data, $n = 2$.
  • For $40\%$ of the data, it is guaranteed that $b_i$ is a multiple of $a_i$.
  • For $60\%$ of the data, it is guaranteed that the given $a_i$ are monotonically increasing.
  • For $80\%$ of the data, it is guaranteed that $n \leq 1000$.
  • For $100\%$ of the data, it is guaranteed that $2 \leq n \leq 10^5$, $1 \leq a_i, b_i \leq 10^9$, and $a_i$ are all distinct.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 2 2 4 3 9
样例输出
3