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 Ruby (2.3.3) (judge verdict: Accepted)

Point = Struct.new(:x, :y)

def get_circulm_center(a, b, c)
  aa = (b.x - c.x) ** 2 + (b.y - c.y) ** 2
  bb = (a.x - c.x) ** 2 + (a.y - c.y) ** 2
  cc = (b.x - a.x) ** 2 + (b.y - a.y) ** 2

  u1 = aa * (bb + cc - aa)
  u2 = bb * (cc + aa - bb)
  u3 = cc * (aa + bb - cc)
  deno = u1 + u2 + u3

  return false if deno == 0
  
  x = ((u1 * a.x) + (u2 * b.x) + (u3 * c.x)) / deno
  y = ((u1 * a.y) + (u2 * b.y) + (u3 * c.y)) / deno

  Point.new(x, y)
end

def dis(a, b)
  square = (a.x - b.x) ** 2 + (a.y - b.y) ** 2
  Math.sqrt(square)
end

def isAllIncluded(r, c, points)
  flag = true
  points.each do |p|
    d = dis(c, p)
    if d > r
      flag = false
      break
    end
  end

  flag
end

def main
  n = gets.chomp.to_i
  points = []
  min = -1

  n.times do |i|
    input = gets.chomp.split.map(&:to_f)
    points.push(Point.new(input[0], input[1]))
  end

  if n == 2
    puts dis(points[0], points[1]) / 2
    return
  end

  #2点の中点から判定
  n.times do |i|
    n.times do |j|
      next if i == j
      c = Point.new((points[i].x + points[j].x) / 2, (points[i].y + points[j].y ) / 2)
      r = dis(points[i], c)
      next if min != -1 && min < r
      next if !isAllIncluded(r, c, points)
      min = r
    end
  end
  
  #３点の外心から判定
  n.times do |i|
    n.times do |j|
      next if i == j
      n.times do |k|
        next if j == k || i == k
        c = get_circulm_center(points[i], points[j], points[k])
        next if c == false
        r = dis(points[i], c)        

        #rが大きい場合は飛ばす
        next if min != -1 && min < r
        #距離r内に全ての点が含まれているか確認
        next if !isAllIncluded(r, c, points)
        min = r 
      end
    end
  end

  puts min
end

main