Maximum perimeter

Given nn different points on the plane, pick any three of them so that the perimeter of the resulting triangle is maximum.

Input

Input consists of several cases, each with nn followed by nn pairs of integer coordinates (x,y)(x, y). Assume 3n1043 \le n \le 10^4, 108x,y108-10^8 \le x, y \le 10^8, and that no three given points are colinear.

Output

For every case, print the maximum perimeter of all the possible triangles with four digits after the decimal point. The input cases have no precision issues.

Observation

All “big” private test cases were built by choosing a “typical” geometric figure (such as a rectangle, a triangle, a circle, an ellipse, or alike), and placing nn points at random inside it, always avoiding repeated points and points that would be collinear with two other points.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:25:41.352Z

© Jutge.org, 2006–2026.
https://jutge.org