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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.util.Scanner;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.Random;

public class Main {
	public static void main(String... args) {
		Scanner input = new Scanner(System.in);

		ArrayList<Point> points = new ArrayList<Point>();
		for (int i = input.nextInt(); i > 0; i--)
			points.add(new Point(input.nextInt(), input.nextInt()));

		System.out.printf("%.7f", smallestEnclosingCircle(points).radius * 2);
	}

	private static Circle smallestEnclosingCircle(ArrayList<Point> points) {
		ArrayList<Point> shuffled = new ArrayList<Point>(points);
		Collections.shuffle(shuffled, new Random());

		Circle circle = null;
		for (int i = 0; i < shuffled.size(); i++) {
			Point p = shuffled.get(i);

			if (circle == null || !circle.contains(p))
				circle = onePoint(shuffled.subList(0, i + 1), p);
		}

		return circle;
	}

	private static Circle onePoint(List<Point> points, Point p) {
		Circle circle = new Circle(p, 0);

		for (int i = 0; i < points.size(); i++) {
			Point q = points.get(i);

			if (!circle.contains(q)) {
				if (circle.radius == 0)
					circle = diameter(p, q);
				else
					circle = twoPoint(points.subList(0, i + 1), p, q);
			}
		}

		return circle;
	}

	private static Circle twoPoint(List<Point> points, Point p, Point q) {
		Circle circ = diameter(p, q);
		Circle left = null;
		Circle right = null;

		Point pq = q.subtract(p);
		for (Point r : points) {
			if (circ.contains(r))
				continue;

			double cross = pq.cross(r.subtract(p));
			Circle c = circumcircle(p, q, r);
			if (c == null)
				continue;
			else if (cross > 0 && (left == null || pq.cross(c.center.subtract(p)) > pq.cross(left.center.subtract(p))))
				left = c;
			else if (cross < 0
					&& (right == null || pq.cross(c.center.subtract(p)) < pq.cross(right.center.subtract(p))))
				right = c;
		}

		if (left == null && right == null)
			return circ;
		else if (left == null)
			return right;
		else if (right == null)
			return left;
		else
			return left.radius <= right.radius ? left : right;
	}

	private static Circle diameter(Point a, Point b) {
		Point c = new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
		return new Circle(c, Math.max(c.distance(a), c.distance(b)));
	}

	private static Circle circumcircle(Point a, Point b, Point c) {
		double d = (a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)) * 2;
		if (d == 0)
			return null;

		double x = (a.norm() * (b.y - c.y) + b.norm() * (c.y - a.y) + c.norm() * (a.y - b.y)) / d;
		double y = (a.norm() * (c.x - b.x) + b.norm() * (a.x - c.x) + c.norm() * (b.x - a.x)) / d;

		Point p = new Point(x, y);
		double r = Math.max(Math.max(p.distance(a), p.distance(b)), p.distance(c));
		return new Circle(p, r);
	}

	private static class Circle {
		public static final double MULTIPLICATIVE_EPSILON = 1 + 1e-14;
		public Point center;
		public double radius;

		public Circle(Point center, double radius) {
			this.center = center;
			this.radius = radius;
		}

		public boolean contains(Point p) {
			return center.distance(p) <= radius * MULTIPLICATIVE_EPSILON;
		}
	}

	private static class Point {
		public double x;
		public double y;

		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}

		public Point subtract(Point p) {
			return new Point(x - p.x, y - p.y);
		}

		public double distance(Point p) {
			return Math.hypot(x - p.x, y - p.y);
		}

		public double cross(Point p) {
			return x * p.y - y * p.x;
		}

		public double norm() {
			return x * x + y * y;
		}
	}
}