from typing import List, Tuple
import random
import math
PI = math.acos(-1)
# 浮点数的符号函数
ESP = 10 ** (-10)
def sign(val: float):
if abs(val) < ESP:
return 0
return 1 if val > 0 else -1
# 向量的外乘积,表示两个向量围成的平行四边形面积,b在a逆时针方向,面积为正,否则面积为负
# 输入是两个向量的坐标(x1, y1), (x2, y2)
def cross(a, b):
return a[0]*b[1] - b[0]*a[1]
# 求解两条直线的交点(注意前提是两条直线不平行)
# p1, v1 是第一条直线的点向式表示,p2, v2 是第二条直线的点向式表示
def intersection_point(p1, v1, p2, v2):
u = (p1[0]-p2[0], p1[1]-p2[1])
t = cross(v2, u) / cross(v1, v2)
return (p1[0] + v1[0]*t, p1[1] + v1[1]*t)
# 判断点是否在圆覆盖范围内
def is_point_in_circle(circle_x, circle_y, circle_r, x, y):
dis = math.sqrt((x - circle_x)**2 + (y - circle_y)**2)
if abs(dis - circle_r) < ESP:
return True
if dis < circle_r:
return True
return False
# 求解向量顺时针旋转theta角度(弧度制)后的向量, 逆时针旋转theta等价于顺时针旋转-theta
def vec_rotate(v, theta):
x, y = v
return (x * math.cos(theta) + y * math.sin(theta), -x * math.sin(theta) + y * math.cos(theta))
# 获取外接圆
def get_out_circle(x1, y1, x2, y2, x3, y3):
xx1, yy1 = (x1 + x2) / 2, (y1 + y2) / 2
vv1 = vec_rotate((x2 - x1, y2 - y1), PI / 2)
xx2, yy2 = (x1 + x3) / 2, (y1 + y3) / 2
vv2 = vec_rotate((x3 - x1, y3 - y1), PI / 2)
pp = intersection_point((xx1, yy1), vv1, (xx2, yy2), vv2)
dis = math.sqrt((pp[0] - x1) ** 2 + (pp[1] - y1) ** 2)
return (pp[0], pp[1], dis)
class MinCircleOverlap:
# 求解最小覆盖圆,传入所有点的坐标列表, 返回三元组(圆心x坐标,圆心y坐标,圆半径)
@staticmethod
def get_min_circle_overlap(points: List[Tuple]):
random.shuffle(points)
n = len(points)
p = points
cc1 = (p[0][0], p[0][1], 0)
for ii in range(1, n):
# 第一层循环求解覆盖了点0到点i的最小覆盖圆
if not is_point_in_circle(cc1[0], cc1[1], cc1[2], p[ii][0], p[ii][1]):
cc2 = (p[ii][0], p[ii][1], 0)
for jj in range(ii):
# 第二层循环求解ii在边上,且覆盖了0到jj这些点的最小覆盖圆
if not is_point_in_circle(cc2[0], cc2[1], cc2[2], p[jj][0], p[jj][1]):
dis = math.sqrt((p[jj][0] - p[ii][0]) ** 2 + (p[jj][1] - p[ii][1]) ** 2)
cc3 = ((p[jj][0] + p[ii][0]) / 2, (p[jj][1] + p[ii][1]) / 2, dis / 2)
for kk in range(jj):
# 第三层循环求解ii, jj都在边上且覆盖了0到kk这些点的最小覆盖圆
if not is_point_in_circle(cc3[0], cc3[1], cc3[2], p[kk][0], p[kk][1]):
cc3 = get_out_circle(p[ii][0], p[ii][1], p[jj][0], p[jj][1], p[kk][0], p[kk][1])
cc2 = cc3
cc1 = cc2
return cc1
n = int(input())
points = []
for i in range(n):
x, y = map(float, input().split())
points.append((x, y))
x, y, r = MinCircleOverlap.get_min_circle_overlap(points)
print("%.10f\n%.10f %.10f" % (r, x, y))