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 Haskell (GHC 7.10.3) (judge verdict: Runtime Error)

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map as Map
import Data.Map (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

toTuple (a:b:_) = (a, b)

type Point = (Double, Double)
type Circle = (Point, Double) -- center, radius

circumcircle :: Point -> Point -> Point -> Circle
circumcircle (a, b) (c, d) (e, f) = ((x, y), r)
	where
		y = ((e - a) * (a ^ 2 + b ^ 2 - c ^ 2 - d ^ 2) - (c - a) * (a ^ 2 + b ^ 2 - e ^ 2 - f ^ 2)) / (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f))
		x = if abs (c - a) >= 0.0000001
			then (2 * (b - d) * y - a ^ 2 - b ^ 2 + c ^ 2 + d ^ 2) / (2 * (c - a))
			else (2 * (b - f) * y - a ^ 2 - b ^ 2 + e ^ 2 + f ^ 2) / (2 * (e - a))
		r = sqrt $ (x - a) ^ 2 + (y - b) ^ 2

diff :: Point -> Point -> Point
diff (x1, y1) (x2, y2) = (x2 - x1, y2 - y1)

norm :: Point -> Double
norm (x, y) = sqrt $ x ^ 2 + y ^ 2

contains :: Circle -> Point -> Bool
contains (center, radius) p = (norm $ diff center p) <= radius + 0.0000001

perm :: Int -> [a] -> [[a]]
perm 1 cs = map (:[]) cs
perm n [] = []
perm n (c:cs) = s ++ r
	where
		s = map (c:) $ perm (n - 1) cs
		r = perm n cs

test :: [Point] -> [Point] -> Maybe Double
test points [p1, p2, p3] = if ctest then Just radius else Nothing
	where
		c = circumcircle p1 p2 p3
		ctest = all (contains c) points
		(_, radius) = c

main :: IO ()
main = do
	n <- readLn
	points <- map (toTuple . map read . words) <$> replicateM n getLine :: IO [Point]
	if n == 2 then do
		let p1 = points !! 0
		let p2 = points !! 1
		print $ (norm $ diff p1 p2) / 2
	else do
		let triangles = perm 3 points
		print $ minimum $ Maybe.catMaybes $ map (test points) triangles