#P11581. Determining the Minimum Required Speed

    ID: 13674 Type: Default 1000ms 256MiB

Determining the Minimum Required Speed

Determining the Minimum Required Speed

Trick E. Dingo is tracking the elusive Street Sprinter along a straight east–west road, where positions are measured relative to a famous stone called the "origin" (with positions west of the origin being negative and east positive). Each observation consists of a time and the corresponding position of Street Sprinter. Based on these observations, determine the minimum speed that Street Sprinter must have reached.

Formally, you are given n observations. The i-th observation is given by time \(t_i\) and position \(x_i\). After sorting the observations by time, the minimum required speed is computed as:

[ S = \max_{1 \le i < n} \frac{|x_{i+1} - x_i|}{t_{i+1} - t_i} ]

Print the value of \(S\).

inputFormat

The first line contains an integer n (\(n \ge 2\)), the number of observations. Each of the following n lines contains two space-separated numbers: the time \(t_i\) and the position \(x_i\) at that time. It is guaranteed that the times are not necessarily sorted but are distinct and positive, and the positions are integers which could be negative.

outputFormat

Output a single number which is the minimum speed that Street Sprinter must have reached. The answer is calculated as the maximum of \(\frac{|x_{i+1} - x_i|}{t_{i+1} - t_i}\) for consecutive observations after sorting by time.

sample

2
1 10
3 20
5.0