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 Rust (1.15.1) (judge verdict: Accepted)

#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

struct Circle {
    x: f64,
    y: f64,
    radius: f64,
}

impl Circle {
    fn included(&self, x: f64, y: f64) -> bool {
        (self.x - x).hypot(self.y - y) <= self.radius + 0.00000001
    }
}

fn main() {
    let n = read::<usize>();
    let mut points = vec![];
    for i in 0..n {
        let v = read_vec::<f64>();
        points.push((v[0], v[1]));
    }

    let mut ans = 100000.0;
    for i in 0..n {
        for j in i + 1..n {
            let cx = (points[i].0 + points[j].0) / 2.0;
            let cy = (points[i].1 + points[j].1) / 2.0;
            let mut rad = 0.0;
            for &(px, py) in points.iter() {
                rad = max(Total(rad), Total((cx - px).hypot(cy - py))).0;
            }
            ans = min(Total(ans), Total(rad)).0;
        }
    }

    for i in 0..n {
        for j in i + 1..n {
            'k: for k in j + 1..n {
                let ex = (points[i].0 + points[j].0) / 2.0;
                let ey = (points[i].1 + points[j].1) / 2.0;
                let fx = (points[k].0 + points[j].0) / 2.0;
                let fy = (points[k].1 + points[j].1) / 2.0;
                let a = (points[j].1 - points[i].1).atan2(points[j].0 - points[i].0)
                    + std::f64::consts::PI * 0.5;
                let b = (points[k].1 - points[j].1).atan2(points[k].0 - points[j].0)
                    + std::f64::consts::PI * 0.5;
                let tana = a.tan();
                let tanb = b.tan();

                let cx = (ey - fy - ex * tana + fx * tanb) / (tanb - tana);
                let cy = ey - (ex - cx) * tana;
                let rad = (points[i].1 - cy).hypot(points[i].0 - cx);
                let circle = Circle {
                    x: cx,
                    y: cy,
                    radius: rad,
                };
                for &(px, py) in points.iter() {
                    if !circle.included(px, py) {
                        continue 'k;
                    }
                }
                ans = min(Total(ans), Total(rad)).0;
            }
        }
    }

    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}