Maximum perimeter

Given n 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 n followed by n pairs of
integer coordinates (x, y). Assume 3 ≤ n ≤ 10⁴, −10⁸ ≤ x, y ≤ 10⁸, 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 n 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
