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 C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>

using namespace std;

const int MaxN = 1e5 + 15;
const int INF = 1e9;
const int MOD = 1e9 + 7;

const long double PI = acos(-1);

struct point{
    long double x, y;
    int num;
    point()
    {

    }
    point(long double x, long double y) : x(x), y(y)
    {

    }
    bool operator < (const point & oth) const
    {
        return make_pair(x, y) < make_pair(oth.x, oth.y);
    }
    bool operator == (const point & oth) const
    {
        return make_pair(x, y) == make_pair(oth.x, oth.y);
    }
    void print()
    {
        cout << x << ' ' << y << ' ' << num << '\n';
    }
};

struct line{
    long double a, b, c;
    line(point q, point p)
    {
        a = p.y - q.y;
		b = q.x - p.x;
		c = -a * p.x - b * p.y;
		norm();
    }
    void norm() {
		long double z = sqrt (a*a + b*b);
		if (abs(z) > 1e-9)
			a /= z,  b /= z,  c /= z;
	}
};

long double area(point a, point b, point c)
{
    return (c.y - a.y) * (b.x - a.x) - (b.y - a.y) * (c.x - a.x);
}

long double dist(long double x, long double y, long double xx, long double yy)
{
    return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}

long double dist(point a, point b)
{
    return dist(a.x, a.y, b.x, b.y);
}

vector <point> v;

long double ans[MaxN];

long double det (long double a, long double b, long double c, long double d) {
	return a * d - b * c;
}

point inter(line m, line n)
{
    long double zn = det (m.a, m.b, n.a, n.b);
    point res;
    res.x = -det (m.c, m.b, n.c, n.b) / zn;
	res.y = -det (m.a, m.c, n.a, n.c) / zn;
	res.num = -1;
	return res;
}

int main()
{
//    freopen("input.txt", "r", stdin);

    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    v.resize(n);

    for(int i = 0; i < n; ++i)
    {
        cin >> v[i].x >> v[i].y;
        v[i].num = i + 1;
    }

    sort(v.begin(), v.end());

    vector <point> v1, v2;

    v1.push_back(v[0]);
    v2.push_back(v[0]);

    for(int i = 1; i + 1 < v.size(); ++i)
    {
        if(area(v[0], v[i], v.back()) < 0)
            v1.push_back(v[i]);
        else
        if(area(v[0], v[i], v.back()) > 0)
            v2.push_back(v[i]);
    }

    v1.push_back(v.back());
    v2.push_back(v.back());

    vector <point> res;

    res.push_back(v1[0]);

    for(int i = 1; i < v1.size(); ++i)
    {
        while(res.size() > 1 && area(res[res.size() - 2], res[res.size() - 1], v1[i]) >= 0)
            res.pop_back();
        res.push_back(v1[i]);
    }

    for(int i = v2.size() - 2; i > 0; --i)
    {
        while(res.size() > 1 && area(res[res.size() - 2], res[res.size() - 1], v2[i]) >= 0)
            res.pop_back();
        res.push_back(v2[i]);
    }

    res.push_back(res[0]);
    res.push_back(res[1]);

    if(res.size() == 4)
    {
        ans[res[0].num] = ans[res[1].num] = 0.5;
    }else
    {
        for(int i = 1; i + 1 < res.size(); ++i)
        {
            point x1;

            x1.x = res[i - 1].x - res[i].x;
            x1.y = res[i - 1].y - res[i].y;

            swap(x1.x, x1.y);
            x1.y = -x1.y;

            point c1;

            c1.x = (res[i].x + res[i - 1].x) / 2.;
            c1.y = (res[i].y + res[i - 1].y) / 2.;

            line a = line(c1, point(c1.x + x1.x, c1.y + x1.y));

            point x2;

            x2.x = res[i + 1].x - res[i].x;
            x2.y = res[i + 1].y - res[i].y;

            swap(x2.x, x2.y);
            x2.x = -x2.x;

            point c2;

            c2.x = (res[i].x + res[i + 1].x) / 2.;
            c2.y = (res[i].y + res[i + 1].y) / 2.;

            line b = line(c2, point(c2.x + x2.x, c2.y + x2.y));

            point k = inter(a, b);

            c1 = point(k.x + x1.x, k.y + x1.y);
            c2 = point(k.x + x2.x, k.y + x2.y);

            long double C = dist(c1, c2);
            long double A = dist(c1, k);
            long double B = dist(c2, k);

            long double p = acos((C * C - A * A - B * B) / (-2 * A * B));

            ans[res[i].num] = p / PI / 2.;
        }
    }

    for(int i = 1; i <= n; ++i)
    {
        cout.precision(10);
        cout << fixed << ans[i] << '\n';
    }
    return 0;
}