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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.util.*;
import java.io.*;

public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;

    class Point {
        int x;
        int y;
        int id;
        public Point(int x, int y, int id){
            this.x = x;
            this.y = y;
            this.id = id;
        }

        @Override
        public String toString() {
            return "x: " + x + ", y: " + y + ", id: " + id;
        }
    }
    void solve() throws IOException {
        int n = nextInt();
        Point[] arr = new Point[n];
        for (int i = 0; i < n; i++) {
            int x = nextInt();
            int y = nextInt();
            arr[i] = new Point(x, y, i);
        }
        List<Point> remove = new ArrayList<>();
        boolean[] vis = new boolean[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < n; k++) {
                    if (j != i && j != k && k != i) {
                        long dx1 = arr[k].x - arr[i].x;
                        long dy1 = arr[k].y - arr[i].y;

                        long dx2 = arr[k].x - arr[j].x;
                        long dy2 = arr[k].y - arr[j].y;

                        long dx3 = arr[j].x - arr[i].x;
                        long dy3 = arr[j].y - arr[i].y;
                        long d1 = dx1 * dx1 + dy1 * dy1;
                        long d2 = dx2 * dx2 + dy2 * dy2;
                        long d3 = dx3 * dx3 + dy3 * dy3;
                        double dist = Math.sqrt(d1) + Math.sqrt(d2);
                        dist -= Math.sqrt(d3);
                        if (dist < 1e-6) {
                            vis[k] = true;
                        }
                    }
                }
            }
        }

        for (int i = 0; i < n; i++) {
            if (!vis[i]) {
                remove.add(arr[i]);
            }
        }

        int sz0 = remove.size();
        Point[] narr = new Point[sz0];
        for (int i = 0; i < sz0; i++) {
            narr[i] = remove.get(i);
        }

        List<Point> hull = convexHull(narr);
        double[] res = new double[n];
        int sz = hull.size();
        for (int i = 0; i < sz; i++) {
            Point cur = hull.get(i);
            Point prev = hull.get((i - 1 + sz) % sz);
            Point nxt = hull.get((i + 1) % sz);

            double angle = getAngle(cur, prev, nxt);
            res[cur.id] = angle / 2  / Math.PI;
        }

        for (int i = 0; i < n; i++) {
            outln(res[i]);
        }
    }

    double getAngle(Point cur, Point prev, Point nxt) {
        Point d1 = new Point(prev.x - cur.x, prev.y - cur.y, 0);
        Point d2 = new Point(nxt.x - cur.x, nxt.y - cur.y, 0);
        double div = 1.0;
        div *= 1.0 * d1.x * d2.x + 1.0 * d1.y * d2.y;
        div /= Math.sqrt(1.0 * d1.x * d1.x + 1.0 * d1.y * d1.y);
        div /= Math.sqrt(1.0 * d2.x * d2.x + 1.0 * d2.y * d2.y);
        return Math.PI - Math.acos(div);
    }

    public List<Point> convexHull(Point points[]) {
        int n = points.length;
        List<Point> hull = new ArrayList<>();
        if (n < 3) {
            for (int i = 0; i < n; i++) {
                hull.add(points[i]);
            }
            return hull;
        }

        int l = 0;
        for (int i = 1; i < n; i++)
            if (points[i].x < points[l].x)
                l = i;

        int p = l, q;
        do {
            hull.add(points[p]);
            q = (p + 1) % n;

            for (int i = 0; i < n; i++) {
                if (orientation(points[p], points[i], points[q]) == 2)
                    q = i;
            }

            p = q;

        } while (p != l);

        return hull;
    }

    int orientation(Point p, Point q, Point r) {
        long val = 1L * (q.y - p.y) * (r.x - q.x) -
                1L * (q.x - p.x) * (r.y - q.y);

        if (val == 0) return 0;  // collinear
        return (val > 0)? 1 : 2; // clock or counterclock wise
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}