Flower Festival
InterviewTime limit2sMemory limit1024 MB
Given each car's position and constant speed on a road of length f, find the number of the car that reaches the end first.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Today is the Flower Festival. The festival is held in Rose Square, at the end of Flower Street. People are driving toward the festival on Flower Street in cars, numbered 1 through . Soroush, a traffic analyst, has used the traffic cameras on Flower Street to record the current location and speed of every car. Each car keeps a constant speed for the whole trip. A car's location is its distance from the start of Flower Street. Help Soroush find the first car to arrive at the festival. No two cars reach Rose Square at the same time.
Input
The first line contains two space-separated integers () and (), the number of cars and the length of Flower Street. The -th line () contains two space-separated integers () and (), the observed location and speed of car .
Output
Print the number of the car that arrives at Rose Square first.