#K78987. Smallest Enclosing Circle

    ID: 35208 Type: Default 1000ms 256MiB

Smallest Enclosing Circle

Smallest Enclosing Circle

You are given n points on the plane. Your task is to determine the smallest circle that encloses all the given points. The circle is represented by its center coordinates and its radius.

The problem requires you to calculate the Euclidean distance and, in some cases, derive the circumcenter of three non-collinear points using the formula:

\( C_x = \frac{D\cdot E - B\cdot F}{G} \) and \( C_y = \frac{A\cdot F - C\cdot E}{G} \), where the variables are defined based on the coordinates of the points.

If there is only one point, then the circle is a point with a radius of zero. For two points, the smallest enclosing circle is the one with the line segment connecting them as the diameter. For three or more points, the circle might be defined either by a pair of points or by a triplet defining the circle through them.

Print the center coordinates and the radius of the computed circle with two decimal places of precision.

inputFormat

The input is given via standard input in the following format:

n
x1 y1
x2 y2
... 
xn yn

where n is the number of points, and each of the following n lines contains two space-separated integers representing the x and y coordinates of a point.

outputFormat

Print a single line to standard output with three numbers: the x-coordinate and y-coordinate of the center, and the radius of the smallest enclosing circle. Each number must be formatted to two decimal places.

center_x center_y radius
## sample
1
0 0
0.00 0.00 0.00