P18152 [NWERC 2026] Autobahn

Description

On your way to Karlsruhe, you and your team were driving on the Autobahn for hours. You saw cars overtaking each other, cars overtaking you, and sometimes, you even overtook some cars. Assuming all cars currently driving on the Autobahn maintained their speed, when would the last overtake happen, so everyone could finally drive in peace? To model this problem under idealized conditions, we will assume that the Autobahn is a line that starts at $x=0$ and continues indefinitely towards positive $x$. The cars will be points on this line, each travelling at a constant speed in the positive $x$ direction. There are $n$ cars on the Autobahn. These cars never leave the Autobahn and no new cars enter the Autobahn. At time $0$, car $i$ is at $x_i$ kilometres past the start of the Autobahn. The constant speed of car $i$ is $v_i$ kilometres per hour. An overtake happens when a faster car reaches the same $x$ position as a slower car. Notice that once a faster car overtakes a slower car, this pair of cars will never meet again, so overtakes will not go on forever. Determine the time when the last overtake happens.

Input Format

The input consists of: - One line with an integer $n$ ($2\leq n\leq 150\,000$), the number of cars. - $n$ lines, the $i$th of which contains two integers $x_i$ and $v_i$ ($1\leq x_i,v_i\leq 10^9$), the initial position and speed of the $i$th car. No two cars will have the same initial position, although cars can share the same speed. At least one overtake will happen at some point in the future.

Output Format

Output the time, in hours, when the last overtake happens. Your answer should have an absolute or relative error of at most $10^{-6}$.