405298: GYM101875 G Traffic Management

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Traffic Managementtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Sancho was making a road trip with his family and got really bored, so he recorded the position and initial speed of every car on the highway. For Sancho, the highway is an infinite straight line, the starting time is 0, the cars are moving points, and no car will pass another car (Sancho is very idealistic).

The cars maintain their initial speed unless they are slowed down by other cars. Car A is slowed down by car B if B started in front of A, but after a while, A reached B. When this happens, both cars move together and A's speed becomes the same as B's.

Sancho knows that there will be only a finite amount of times that a car will be slowed down by another car, and wants to know when the last slowing down will take place. If no car will be slowed down, the answer is 0.

Input

The first line of the input contains a single integer N (1 ≤ N ≤ 105), indicating the number of cars.

N lines follow. The i-th line contains two integers Si and Vi (0 ≤ S, V ≤ 109), indicating the starting position of the i-th car and its speed. No two cars start in the same position.

Output

Output a single decimal number - the time of the last slow down. Your answer will be considered correct if the absolute or relative error is no greater than 10 - 4.

Namely: let's assume that your answer is a, and the official answer is b. The checker program will consider your answer correct, if .

ExampleInput
4
0 10
10 3
20 3
30 2
Output
20.000000

Source/Category

加入题单

算法标签: