Problem:
Score : 600 points

Problem Statement

There are N holes in a two-dimensional plane. The coordinates of the i-th hole are (x_i,y_i).

Let R=10^{10^{10^{10}}}. Ringo performs the following operation:

Randomly choose a point from the interior of a circle of radius R centered at the origin, and put Snuke there. Snuke will move to the hole with the smallest Euclidean distance from the point, and fall into that hole. If there are multiple such holes, the hole with the smallest index will be chosen.

For every i (1 \leq i \leq N), find the probability that Snuke falls into the i-th hole.

Here, the operation of randomly choosing a point from the interior of a circle of radius R is defined as follows:

Pick two real numbers x and y independently according to uniform distribution on [-R,R].

If x^2+y^2\leq R^2, the point (x,y) is chosen. Otherwise, repeat picking the real numbers x,y until the condition is met.

Constraints

2 \leq N \leq 100

|x_i|,|y_i| \leq 10^6(1\leq i\leq N)

All given points are pairwise distinct.

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
:
x_N y_N

Output

Print N real numbers. The i-th real number must represent the probability that Snuke falls into the i-th hole.

The output will be judged correct when, for all output values, the absolute or relative error is at most 10^{-5}.

Sample Input 1

2
0 0
1 1

Sample Output 1

0.5
0.5

If Ringo put Snuke in the region x+y\leq 1, Snuke will fall into the first hole. The probability of this happening is very close to 0.5.
Otherwise, Snuke will fall into the second hole, the probability of which happening is also very close to 0.5.

Sample Input 2

5
0 0
2 8
4 5
2 6
3 10

Sample Output 2

0.43160120892732328768
0.03480224363653196956
0.13880483535586193855
0.00000000000000000000
0.39479171208028279727

Solution in Haskell (GHC 7.10.3) (judge verdict: Accepted)

{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    points <- map(\(x,y)->P (fromIntegral x) (fromIntegral y)).U.toList.U.unfoldrN n parseInt2 <$> B.getContents
    mapM_ print $ solve n points

solve :: Int -> [Point] -> [Double]
solve 2 _      = [0.5, 0.5]
solve n points = [maybe 0.0 id $ M.lookup p probs|p<-points]
    where
      convex = convexHull points
      doubleDot x y = fromIntegral $ dot x y
      probs :: M.Map Point Double
      probs = case convex of
          [x, y] -> M.fromList [(x,0.5),(y,0.5)]
          _      -> go M.empty $ convex ++ convex
      go :: M.Map Point Double -> [Point] -> M.Map Point Double
      go res (x:o:y:rest) = go (M.insert o (acos c / pi / 2) res) (o:y:rest)
        where
          c = -doubleDot(x-o)(y-o) / (sqrt(doubleDot(x-o)(x-o)) * sqrt(doubleDot(y-o)(y-o)))
      go res _ = res
        where
          ps = map snd $ M.toList res

-------------------------------------------------------------------------------
type Parser a = B.ByteString -> Maybe (a, B.ByteString)

parseInt :: Parser Int
parseInt = B.readInt . B.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (B.readInt . B.dropWhile isSpace)
    <*> StateT (B.readInt . B.unsafeTail)

data Point = P !Integer !Integer deriving (Eq, Ord)
type Seg = (Point, Point)
type Polygon = [Point]
type Convex = [Point]

instance Show Point where
  show (P x y) = show (x,y)

instance Num Point where
  (P x0 y0) + (P x1 y1) = P (x0 + x1) (y0 + y1)
  (P x0 y0) - (P x1 y1) = P (x0 - x1) (y0 - y1)
  (P x0 y0) * (P x1 y1) = P (x0 * x1 - y0 * y1) (x0 * y1 + x1 * y0)
  negate (P x y) = P (negate x) (negate y)
  abs _ = undefined
  signum _ = undefined
  fromInteger n = P n 0

infixr 7 *:
(*:) :: Integer -> Point -> Point
(*:) !k (P x y) = P (k * x) (k * y)
{-# INLINE (*:) #-}

dot :: Point -> Point -> Integer
dot (P x0 y0) (P x1 y1) = x0 * x1 + y0 * y1
{-# INLINE dot #-}

cross :: Point -> Point -> Integer
cross (P x0 y0) (P x1 y1) = x0 * y1 - y0 * x1
{-# INLINE cross #-}

--        v
--       /  <==> area o u v > 0
--  o---u
area :: Point -> Point -> Point -> Integer
area o u v = (u - o) `cross` (v - o)
{-# INLINE area #-}

--        v
--       /  <==> compCCW o u v == LT
--  o---u
compCCW :: Point -> Point -> Point -> Ordering
compCCW o u v = compare 0 $ area o u v
{-# INLINE compCCW #-}

compCW :: Point -> Point -> Point -> Ordering
compCW o u v = compCCW o v u
{-# INLINE compCW #-}

onSeg :: Point -> Seg -> Bool
onSeg p (q0, q1) = (q0 - p) `cross` (q1 - p) == 0
                 && (q0 - p) `dot` (q1 - p) < 0
{-# INLINE onSeg #-}

segIntersect :: Seg -> Seg -> Bool
segIntersect (p0, p1) (q0, q1) = (area p0 q0 q1) * (area p1 q0 q1) < 0
                               && (area q0 p0 p1) * (area q1 p0 p1) < 0
{-# INLINE segIntersect #-}

convexHull :: [Point] -> Convex
convexHull ps = reverse.go [v0].sortBy (compCCW v0) $ filter (/=v0) ps
   where
     !v0 = minimum ps
     go (p:q:conv) (r:rs) = case compCCW q p r of
        LT -> go (r:p:q:conv) rs
        GT -> go (q:conv) (r:rs)
        EQ | (q-p) `dot` (r-p) < 0 -> go (r:q:conv) rs -- q--p--r
           | otherwise             -> go (p:q:conv) rs -- q--r--p
     go [p] (r:rs) = go [r,p] rs
     go conv [] = conv