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# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		const long MOD = 1000000007;

		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			var xy = new DXY[n];
			for (int i = 0; i < n; i++) {
				double x = cin.Int();
				double y = cin.Int();
				xy[i] = new DXY(x, y);
			}

			double delta = 1e-6;
			double ans = double.MaxValue;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i == j) {
						continue;
					}

					for (int k = 0; k < n; k++) {
						if (i == k || j == k) {
							continue;
						}

						if (DXY.IsOneLine(xy[i], xy[j], xy[k])) {
							continue;
						}

						long l1 = (long)(xy[k].Y - xy[i].Y) * (long)(xy[j].X - xy[i].X);
						long l2 = (long)(xy[j].Y - xy[i].Y) * (long)(xy[k].X - xy[i].X);
						if (l1 == l2) {
							continue;
						}

						DXY center = DXY.Circumcenter(xy[i], xy[j], xy[k]);
						double r = DXY.Length(center, xy[i]);

						bool ok = true;
						for (int l = 0; l < n; l++) {
							double d = DXY.Length(center, xy[l]);
							if (d > r + delta) {
								ok = false;
								break;
							}
						}

						if (ok) {
							ans = Math.Min(ans, r);
						}
					}
				}
			}

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i == j) {
						continue;
					}

					double r = DXY.Length(xy[i], xy[j]) / 2;
					DXY center = new DXY((xy[i].X + xy[j].X) / 2, (xy[i].Y + xy[j].Y) / 2);

					bool ok = true;
					for (int l = 0; l < n; l++) {
						double d = DXY.Length(center, xy[l]);
						if (d > r + delta) {
							ok = false;
							break;
						}
					}

					if (ok) {
						ans = Math.Min(ans, r);
					}
				}
			}

			Console.WriteLine(ans);
		}
	}

	public struct DXY
	{
		public static double Length(DXY p, DXY q)
		{
			double x = p.X - q.X;
			double y = p.Y - q.Y;
			return Math.Sqrt(x * x + y * y);
		}

		public static bool IsOneLine(DXY a, DXY b, DXY c)
		{
			return a.Y * (b.X - c.X) + b.Y * (c.X - a.X) + c.Y * (a.X - b.X) == 0;
		}

		public static DXY Circumcenter(DXY A, DXY B, DXY C)
		{
			double px = B.X - A.X;
			double py = B.Y - A.Y;
			double qx = C.X - A.X;
			double qy = C.Y - A.Y;

			double x = A.X + (qy * (px * px + py * py) - py * (qx * qx + qy * qy)) / (px * qy - py * qx) / 2;
			double y = (py != 0)
				? (px * (A.X + B.X - x - x) + py * (A.Y + B.Y)) / py / 2
				: (qx * (A.X + C.X - x - x) + qy * (A.Y + C.Y)) / qy / 2;
			return new DXY(x, y);

			/*
			double a = Length(B, C);
			double b = Length(C, A);
			double c = Length(A, B);

			double a2 = a * a;
			double b2 = b * b;
			double c2 = c * c;

			double denominator = a2 * (b2 + c2 - a2) + b2 * (a2 + c2 - b2) + c2 * (a2 + b2 - c2);
			double x = a2 * (b2 + c2 - a2) * A.X + b2 * (a2 + c2 - b2) * B.X + c2 * (a2 + b2 - c2) * C.X
				/ denominator;
			double y = a2 * (b2 + c2 - a2) * A.Y + b2 * (a2 + c2 - b2) * B.Y + c2 * (a2 + b2 - c2) * C.Y
				/ denominator;

			return new DXY(x, y);
			*/
		}

		public static double RadiusOfCircumcircle(double a, double b, double c)
		{
			return a * b * c
				/ Math.Sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
		}

		public double X { get; set; }
		public double Y { get; set; }

		public DXY(double x, double y)
		{
			X = x;
			Y = y;
		}

		public override int GetHashCode()
		{
			var hashCode = 1861411795;
			hashCode = hashCode * -1521134295 + X.GetHashCode();
			hashCode = hashCode * -1521134295 + Y.GetHashCode();
			return hashCode;
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}