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++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
#include <complex>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

#define EPS 1.0e-8

typedef complex<double> P;
namespace std{bool operator<(const P& a, const P& b){
  return real(a)!=real(b)?real(a)<real(b):imag(a)<imag(b);
}}
double inP(const P& p, const P& q){ return real(conj(p)*q); }
double outP(const P& p, const P& q){ return imag(conj(p)*q); }
struct L : public vector<P> {
  L(const P& a, const P& b){ push_back(a); push_back(b); }
};
typedef vector<P> G;

int ccw(P a, P b, P c){
  b-=a; c-=a;
  if(outP(b,c)>0) return +1;
  if(outP(b,c)<0) return -1;
  if(inP(b,c)<0) return +2;
  if(norm(b)<norm(c)) return -2;
  return 0;
}

G convex_hull(vector<P> &ps){
  int n=ps.size(),k=0;
  sort(ps.begin(),ps.end());
  vector<P> ch(2*n);
  for(int i=0;i<n;ch[k++]=ps[i++])
    while(k>=2&&ccw(ch[k-2],ch[k-1],ps[i])<=0)--k;
  for(int i=n-2,t=k+1;i>=0;ch[k++]=ps[i--])
    while(k>=t&&ccw(ch[k-2],ch[k-1],ps[i])<= 0)--k;
  ch.resize(k-1);
  return ch;
}

double dist(const P& x, const P& y){
  return sqrt((real(x)-real(y))*(real(x)-real(y)) + (imag(x)-imag(y))*(imag(x)-imag(y)));
}

bool check(const P& U, double R, const vector<P>& v){
  rep(i,v.size()){
    double tmp = dist(U, v[i]);
    if(R < tmp) return false;
  }
  return true;
}

int main(){
  int N;
  cin >> N;
  vector<P> ps;
  rep(i,N){
    int x, y;
    cin >> x >> y;
    ps.push_back(P(x,y));
  }

  if(N == 2){
    printf("%.12lf\n", dist(ps[0], ps[1]) / 2.0);
    return 0;
  }

  G cvx = convex_hull(ps);

  double ret = 10000000000;
  double PI = 3.1415926535897932384626;

  rep(i,cvx.size()){
    REP(j,i+1,cvx.size()){
      REP(k,j+1,cvx.size()){
        double a = dist(cvx[i], cvx[j]);
        double b = dist(cvx[j], cvx[k]);
        double c = dist(cvx[k], cvx[i]);

        int donkaku = -1;
        {
          P x = cvx[i]-cvx[j];
          P y = cvx[k]-cvx[j];
          double theta = acos((real(x)*real(y) + imag(x)*imag(y)) / (abs(x) * abs(y)));
          if(theta > PI/2.0){
            donkaku = 0;
          }
        }
        {
          P x = cvx[j]-cvx[i];
          P y = cvx[k]-cvx[i];
          double theta = acos((real(x)*real(y) + imag(x)*imag(y)) / (abs(x) * abs(y)));
          if(theta > PI/2.0){
            donkaku = 1;
          }
        }
        {
          P x = cvx[i]-cvx[k];
          P y = cvx[j]-cvx[k];
          double theta = acos((real(x)*real(y) + imag(x)*imag(y)) / (abs(x) * abs(y)));
          if(theta > PI/2.0){
            donkaku = 2;
          }
        }
        if(donkaku >= 0){
          double R = 0;
          P U;
          if(donkaku == 0){
            R = c/2.0;
            U = (cvx[k]-cvx[i])/2.0 + cvx[i];
          }
          if(donkaku == 1){
            R = b/2.0;
            U = (cvx[k]-cvx[j])/2.0 + cvx[j];
          }
          if(donkaku == 2){
            R = a/2.0;
            U = (cvx[j]-cvx[i])/2.0 + cvx[i];
          }
          if(check(U,R,ps)){
            ret = min(ret, R);
          }



        
        }else{
          P A = cvx[k];
          P B = cvx[i];
          P C = cvx[j];
          
          P U = a*a*(b*b+c*c-a*a)*A + b*b*(c*c+a*a-b*b)*B + c*c*(a*a+b*b-c*c)*C;
          U /= a*a*(b*b+c*c-a*a) + b*b*(c*c+a*a-b*b) + c*c*(a*a+b*b-c*c);
          
          double R = (a*b*c) / sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
          if(check(U,R,ps)){
            ret = min(ret, R);
          }
        }
      }
    }
  }

  printf("%.12lf\n", ret);
  
  return 0;
}