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)

macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
trait Trisect: Copy {
    fn next(self, other: Self) -> (Self, Self);
    fn section_end(self, other: Self) -> bool;
}
// impl Trisect for usize {
//     fn next(self, other: Self) -> (Self, Self) {
//         if self > other {
//             other + (self - other) / 2
//         } else {
//             self + (other - self) / 2
//         }
//     }
//     fn section_end(self, other: Self) -> bool {
//         (if self > other {
//             self - other
//         } else {
//             other - self
//         }) <= 1
//     }
// }
// impl Trisect for i64 {
//     fn next(self, other: Self) -> Self {
//         (self + other) / 2
//     }
//     fn section_end(self, other: Self) -> bool {
//         (self - other).abs() <= 1
//     }
// }
impl Trisect for f64 {
    fn next(self, other: Self) -> (Self, Self) {
        ((self * 2. + other) / 3., (self + other * 2.) / 3.)
    }
    fn section_end(self, other: Self) -> bool {
        (self - other).abs() <= 1e-8
    }
}
fn ternary_search<T: Trisect, F: Fn(T) -> U, U: PartialOrd>(f: F, left: T, right: T) -> T {
    let mut left = left;
    let mut right = right;
    while !left.section_end(right) {
        let (l, r) = left.next(right);
        if f(l) > f(r) {
            left = l;
        } else {
            right = r;
        }
    }
    left
}
fn main() {
    input! { n, xy: [(f64, f64); n] };
    let dist = |x: f64, y: f64| {
        let mut res = 0.;
        for &(x0, y0) in &xy {
            let d = ((x - x0).powf(2.) + (y - y0).powf(2.)).powf(0.5);
            res = if res > d { res } else { d };
        }
        res
    };
    let x = ternary_search(
        |x| {
            let y = ternary_search(|y| dist(x, y), 0., 1000.);
            dist(x, y)
        },
        0.,
        1000.,
    );
    let y = ternary_search(|y| dist(x, y), 0., 1000.);
    let ans = dist(x, y);
    println!("{}", ans);
}