Problem:
Score : 600 points

Problem Statement

Given are N points (x_i, y_i) in a two-dimensional plane.

Find the minimum radius of a circle such that all the points are inside or on it.

Constraints

2 \leq N \leq 50

0 \leq x_i \leq 1000

0 \leq y_i \leq 1000

The given N points are all different.

The values in input are all integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
:
x_N y_N

Output

Print the minimum radius of a circle such that all the N points are inside or on it.

Your output will be considered correct if the absolute or relative error from our answer is at most 10^{-6}.

Sample Input 1

2
0 0
1 0

Sample Output 1

0.500000000000000000

Both points are contained in the circle centered at (0.5,0) with a radius of 0.5.

Sample Input 2

3
0 0
0 1
1 0

Sample Output 2

0.707106781186497524

Sample Input 3

10
10 9
5 9
2 0
0 0
2 7
3 3
2 5
10 0
3 7
1 9

Sample Output 3

6.726812023536805158

If the absolute or relative error from our answer is at most 10^{-6}, the output will be considered correct.

Solution in C (GCC 9.2.1) (judge verdict: Time Limit Exceeded)

#include <stdio.h>
#include <math.h>

typedef struct {
	long double key;
	int id;
} data;

void merge_sort(data x[], int n)
{
	static data y[51] = {};
	if (n <= 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

int main()
{
	int i, j, k, N, x[51], y[51];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d %d", &(x[i]), &(y[i]));
	if (N == 2) {
		printf("%f\n", sqrt((double)(x[1] - x[2]) * (x[1] - x[2]) + (double)(y[1] - y[2]) * (y[1] - y[2])) / 2.0);
		fflush(stdout);
		return 0;
	}
	
	for (i = 1, x[0] = 0, y[0] = 0; i <= N; i++) {
		x[0] += x[i];
		y[0] += y[i];
	}
	long double cx = (long double)x[0] / N, cy = (long double)y[0] / N;
	data d[51];
	for (i = 1; i <= N; i++) {
		d[i-1].key = sqrtl((cx - x[i]) * (cx - x[i]) + (cy - y[i]) * (cy - y[i]));
		d[i-1].id = i;
	}
	merge_sort(d, N);
	
	/* while (d[N-1].key - d[N-3].key > 1e-7 && sqrtl((cx - (x[d[N-1].id] + x[d[N-2].id]) / 2.0) * (cx - (x[d[N-1].id] + x[d[N-2].id]) / 2.0) + (cy - (y[d[N-1].id] + y[d[N-2].id]) / 2.0) * (cy - (y[d[N-1].id] + y[d[N-2].id]) / 2.0)) > 1e-7) {
		if (d[N-1].key - d[N-2].key > 1e-7) {
			cx += (x[d[N-1].id] - cx) * (d[N-1].key - d[N-2].key) / fabsl(x[d[N-1].id] - cx) / 2.0;
			cy += (y[d[N-1].id] - cy) * (d[N-1].key - d[N-2].key) / fabsl(y[d[N-1].id] - cy) / 2.0;
		} else {
			cx += ((x[d[N-1].id] + x[d[N-2].id]) / 2.0 - cx) * (d[N-1].key - d[N-3].key) / fabsl((x[d[N-1].id] + x[d[N-2].id]) / 2.0 - cx) / 2.0;
			cy += ((y[d[N-1].id] + y[d[N-2].id]) / 2.0 - cy) * (d[N-1].key - d[N-3].key) / fabsl((y[d[N-1].id] + y[d[N-2].id]) / 2.0 - cy) / 2.0;
		}
		for (i = 1; i <= N; i++) {
			d[i-1].key = sqrtl((cx - x[i]) * (cx - x[i]) + (cy - y[i]) * (cy - y[i]));
			d[i-1].id = i;
		}
		merge_sort(d, N);
	} */
	
	long double l, r, m, tx, ty;
	while (1) {
		if (d[N-1].key - d[N-2].key > 1e-10) {
			cx += (x[d[N-1].id] - cx) * (d[N-1].key - d[N-2].key) / fabsl(x[d[N-1].id] - cx) / 2.0;
			cy += (y[d[N-1].id] - cy) * (d[N-1].key - d[N-2].key) / fabsl(y[d[N-1].id] - cy) / 2.0;
		} else {
			l = 0.0;
			r = 1.0;
			while (r - l > 1e-10) {
				m = (l + r) / 2.0;
				tx = (cx * m + (x[d[N-1].id] + x[d[N-2].id]) / 2.0 * (1.0 - m));
				ty = (cy * m + (y[d[N-1].id] + y[d[N-2].id]) / 2.0 * (1.0 - m));
				for (i = 1; i <= N; i++) if (sqrtl((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) > d[N-1].key) break;
				if (i > N) r = m;
				else l = m;
			}
			if (sqrtl((tx - cx) * (tx - cx) + (ty - cy) * (ty - cy)) < 1e-4) break;
			cx = tx;
			cy = ty;
		}
		for (i = 1; i <= N; i++) {
			d[i-1].key = sqrtl((cx - x[i]) * (cx - x[i]) + (cy - y[i]) * (cy - y[i]));
			d[i-1].id = i;
		}
		merge_sort(d, N);
	}
	
	printf("%.10Lf\n", d[N-1].key);
	fflush(stdout);
	return 0;
}