| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| JU Cup 2026 |
|---|
| Finished |
Yamen is organizing a swimming competition for his n friends. The swimming pool has a total length of L meters.
The competition starts with all friends jumping from the starting blocks. Remarkably, they all hit the water at the exact same moment!
However, each friend has a different diving technique and swimming speed. Friend $$$i$$$ lands in the water exactly $$$d_i$$$ meters away from the starting block. From that exact point, they immediately begin swimming towards the finish line at a constant speed of $$$s_i$$$ meters per second.
Yamen wants to know who will win the race. The winner is the first person to reach or go past the Length of the pool.
If multiple friends reach the finish line at the exact same time, the friend with the smallest index (1-based) among them is declared the winner.
Given the pool length and the stats of each friend, determine the index of the winning friend.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — denotes the number of test cases.
The first line of each test case contains two integers $$$n$$$ and $$$L$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le L \le 10^9$$$) — denotes the number of friends and the total length of the swimming pool in meters.
The following $$$n$$$ lines describe the friends. The $$$i$$$-th of these lines contains two integers $$$d_i$$$ and $$$s_i$$$ ($$$0 \le d_i \lt L$$$, $$$1 \le s_i \le 10^9$$$) — denotes the distance the $$$i$$$-th friend reaches upon hitting the water, and their swimming speed in meters per second.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output a single integer: the 1-based index of the friend who wins the competition.
33 10010 220 10 32 5020 514 62 107 18 2
3 1 2
| Name |
|---|

