#P15639. [ICPC 2022 Tehran R] Flower Festival

[ICPC 2022 Tehran R] Flower Festival

题目描述

Today is the Flower Festival day. The festival is held in Rose Square, at the end of Flower Street. People are heading towards the festival on Flower Street with n cars, numbered 1 through n. Soroush, an expert traffic analyst, wants to know which car will arrive at Rose Square first. Using the traffic cameras on Flower Street, he has gathered the current location of all cars, along with their speeds. Each car maintains a constant speed throughout their journey. Also, the location of a car is defined as its distance from the start of Flower Street. Help Soroush find the first car that arrives at the festival. It is guaranteed that no two cars reach Rose Square at the same time.

输入格式

The first line of input contains two space-separated integers n(1n100)n(1 \leq n \leq 100) and f(1f10000)f(1 \leq f \leq 10000), the number of cars and the length of Flower Street, respectively. The (i+1)(i+1)-th line (for 1in1 \leq i \leq n) contains the information of car numbered i, two space-separated integers xi(0xi<f)x_i(0 \leq x_i < f) and vi(1vi100)v_i(1 \leq v_i \leq 100) indicating its observed location and speed, respectively.

输出格式

Print the number of the car which will arrive at Rose Square first.

3 200
0 1
10 5
40 1
2
5 100
0 1
10 3
60 2
75 1
10 4
3