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(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();

    let XY:Vec<_> = (0..N).map(|_|
         (buf_it.next().unwrap().parse::<f64>().unwrap(),
         buf_it.next().unwrap().parse::<f64>().unwrap())
    ).collect();

    let mut ans = 1e9;
    for i in 0..N{
        for j in 0..N{
            for k in 0..N{
                if k==i && k==j{continue;}
                let Va = (XY[i].0 - XY[k].0,XY[i].1 - XY[k].1);
                let Vb = (XY[j].0 - XY[k].0,XY[j].1 - XY[k].1);
                let Vc = (XY[i].0 - XY[j].0,XY[i].1 - XY[j].1);
                let la = norm(Va);
                let lb = norm(Vb);
                let lc = norm(Vc);
                let PosC;
                let rc;
                if la*la+lb*lb<=lc*lc{
                    rc = lc/2.;
                    PosC = ((XY[i].0+XY[j].0)/2.,(XY[i].1+XY[j].1)/2.);
                }else if lb*lb+lc*lc<=la*la{
                    rc = la/2.;
                    PosC = ((XY[i].0+XY[k].0)/2.,(XY[i].1+XY[k].1)/2.);
                }else if lc*lc+la*la<=lb*lb{
                    rc = lb/2.;
                    PosC = ((XY[j].0+XY[k].0)/2.,(XY[j].1+XY[k].1)/2.);
                }else{
                    let CosA = (dot(Vb,Vc)/norm(Vb)/norm(Vc)).abs();
                    let CosB = (dot(Va,Vc)/norm(Va)/norm(Vc)).abs();
                    let CosC = (dot(Vb,Va)/norm(Vb)/norm(Va)).abs();
                    PosC = ((la*CosA*XY[j].0 + lb*CosB*XY[i].0 + lc*CosC*XY[k].0)/(la*CosA+lb*CosB+lc*CosC),
                            (la*CosA*XY[j].1 + lb*CosB*XY[i].1 + lc*CosC*XY[k].1)/(la*CosA+lb*CosB+lc*CosC));
                    rc = norm((PosC.0-XY[i].0,PosC.1-XY[i].1))
                }
                'outer: for _ in 0..1{
                    if ans <= rc{break}
                    for l in 0..N{
                        let rl = norm((PosC.0-XY[l].0,PosC.1-XY[l].1));
                        if rl > rc {
                            break 'outer
                        }
                    }
                    ans = rc;
                }
            }
        }
    }

    println!("{}",ans);


}

fn dot(a:(f64,f64),b:(f64,f64)) -> f64{
    a.0*b.0+a.1*b.1
}
fn norm(V:(f64,f64)) -> f64{
    dot(V,V).sqrt()
}