#P1452. Convex Hull Diameter

    ID: 14738 Type: Default 1000ms 256MiB

Convex Hull Diameter

Convex Hull Diameter

Given n points in the plane, compute the diameter of their convex hull. In other words, find the largest distance between any two points on the convex hull formed by the given points. The diameter is defined as:

\(\text{diameter} = \max_{p, q \in CH(P)} \; d(p,q)\)

where \(CH(P)\) denotes the convex hull of the set of points \(P\) and \(d(p,q)\) is the Euclidean distance between points \(p\) and \(q\).

You may assume that the absolute or relative error of up to 10-6 is acceptable.

inputFormat

The input begins with an integer n (1 ≤ n ≤ 105) indicating the number of points. The following n lines each contain two space-separated numbers denoting the x and y coordinates of a point. Coordinates can be integers or real numbers.

Example:

5
0 0
0 1
1 0
1 1
0.5 0.5

outputFormat

Output a single floating-point number representing the diameter of the convex hull. It is recommended to output the answer with at least 6 digits after the decimal point. The answer is accepted if the absolute or relative error does not exceed 10-6.

sample

5
0 0
0 1
1 0
1 1
0.5 0.5
1.414214