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 Kotlin (1.0.0) (judge verdict: Accepted)

import java.lang.Math

data class Point(val x: Double, val y: Double) {
    companion object {
        // 外積
        fun cross(a: Point, b: Point) = a.x * b.y - a.y * b.x
    }

    operator fun unaryMinus() = Point(-x, -y)
    operator fun inc() = Point(x + 1.0, y + 1.0)
    operator fun dec() = Point(x - 1.0, y - 1.0)
    operator fun plus(inc: Point) = Point(x + inc.x, y + inc.y)
    operator fun minus(dec: Point) = Point(x - dec.x, y - dec.y)
    operator fun times(mul: Double) = Point(x * mul, y * mul)
    operator fun div(div: Double) = Point(x / div, y / div)

    // ノルム(≒絶対値の2乗)
    fun norm() = x * x + y * y

    // 絶対値
    fun abs() = Math.sqrt(norm())
}
operator fun Double.times(p: Point) = Point(toDouble() * p.x, toDouble() * p.y)

fun main(args: Array<String>) {
    val N = readInputLine().toInt()

    val p = Array<Point>(N) { val (x, y) = readInputLine().split(" ").map { it.toDouble() }; Point(x, y)}

    val c = getMinCircle(p)

    println(Math.sqrt(c.second))
}

fun readInputLine(): String {
    return readLine()!!
}

// 最小包含円を求める関数
// 中心座標と半径の*2乗*のペアを返す
// https://tubo28.me/compprog/algorithm/minball/
fun getMinCircle(points: Array<Point>): Pair<Point, Double> {
    val eps = 1e-10

    if (points.isEmpty()) {
        return Pair(Point(0.0, 0.0), 0.0)
    }

    if (points.size == 1) {
        return Pair(points[0], 0.0)
    }

    fun makeCircle2(a: Point, b: Point): Pair<Point, Double> {
        val c = (a + b) / 2.0
        val r = (a - c).norm()
        return Pair(c, r)
    }

    fun makeCircle3(a: Point, b: Point, c: Point): Pair<Point, Double> {
        val A = (b - c).norm()
        val B = (c - a).norm()
        val C = (a - b).norm()
        val S = Point.cross(b - a, c - a)
        val p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4.0 * S * S)
        val r = (p - a).norm()
        return Pair(p, r)
    }

    fun isInCircle(a: Point, c: Pair<Point, Double>): Boolean {
        return (a - c.first).norm() <= c.second + eps
    }

    var c = makeCircle2(points[0], points[1])

    for (i in 2 until points.size) {
        if (!isInCircle(points[i], c)) {
            c = makeCircle2(points[0], points[i])
            for (j in 1 until i) {
                if (!isInCircle(points[j], c)) {
                    c = makeCircle2(points[i], points[j])
                    for (k in 0 until j) {
                        if (!isInCircle(points[k], c)) {
                            c = makeCircle3(points[i], points[j], points[k])
                        }
                    }
                }
            }
        }
    }

    return c
}