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.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    double[] x = new double[n];
    double[] y = new double[n];
    for(int i = 0; i < n; i++) {
      x[i] = sc.nextDouble();
      y[i] = sc.nextDouble();
    }
    double ans = 0;
    double left = 0;
    double right = 2000;
    for(int q = 0; q < 50; q++) {
      double med = (left + right) / 2;
      int p = 0;
      for(int i = 0; i < n - 1; i++) {
        for(int j = i + 1; j < n; j++) {
          double t = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
          if(t <= (4 * med * med)) {
            double tx = (x[i] + x[j]) / 2;
            double ty = (y[i] + y[j]) / 2;
            double d = (med * med) - ((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
            d = (double)Math.sqrt(d);
            double x1 = 0;
            double y1 = 0;
            double x2 = 0;
            double y2 = 0;
            if(y[i] == y[j]) {
              x1 = tx;
              x2 = tx;
              y1 = ty + d;
              y2 = ty - d;
            } else if(x[i] == x[j]) {
              y1 = ty;
              y2 = ty;
              x1 = tx + d;
              x2 = tx - d;              
            } else {
              double s = (x[j] - x[i]) / (y[i] - y[j]);
              double s1 = (double)Math.sqrt(1 + s * s);
              double m = d / s1;
              double dx = m;
              double dy = (s * dx);
              double ddx = ((-1) * m);
              double ddy = (s * ddx);
              x1 = tx + dx;
              x2 = tx + ddx;
              y1 = ty + dy;
              y2 = ty + ddy;
            }

            int p1 = 0;
            int p2 = 0;

            for(int k = 0; k < n; k++) {
              double t1 = (x1 - x[k]) * (x1 - x[k]) + (y1 - y[k]) * (y1 - y[k]);
              double t2 = (x2 - x[k]) * (x2 - x[k]) + (y2 - y[k]) * (y2 - y[k]);
              if(t1 > (med * med)) p1++;
              if(t2 > (med * med)) p2++;
            }

            if((p1 == 0) || (p2 == 0)) p++;
          }
        }
      }
      if(p == 0) {
        left = med;
      } else {
        right = med;
      }
      ans = med;
    }
    System.out.println(ans);
  }
}