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



Sample input:
2
0 0
1 1


Sample output:
0.5
0.5

Submission status: Wrong Answer

Solution code:
from math import acos
pi = 3.14159265358979323846264338
N = int(input())
A = [[0, 0, 0, _] for _ in range(N)]
flg = [False for _ in range(N)]
for i in range(N):
    A[i][1], A[i][2] = map(int, input().split())
    A[i][0] = A[i][1] * A[i][1] + A[i][2] * A[i][2]
X = [[A[i][1], A[i][2]] for i in range(N)]
A.sort(reverse=True)
stx, sty = A[0][1], A[0][2]
px, py = stx, sty
flg[A[0][3]] = True
prev_point = A[0][3]
convex_hull = [A[0][3]]
while True:
    min_prod2 = [[1, 1], [N+1, N+1], 1]
    for i in range(N):
        for j in range(N):
            if i != prev_point and j != prev_point:
                ffflg = True
                dx1 = X[i][0] - px
                dx2 = X[j][0] - px
                dy1 = X[i][1] - py
                dy2 = X[j][1] - py
                inner_prod = dx1 * dx2 + dy1 * dy2
                norm1 = dx1 * dx1 + dy1 * dy1
                norm2 = dx2 * dx2 + dy2 * dy2
                sign = (inner_prod > 0) - (inner_prod < 0)
                if sign < min_prod2[2]:
                    min_prod2[0] = [inner_prod*inner_prod, norm1*norm2]
                    min_prod2[1] = [i, j]
                    min_prod2[2] = sign
                elif sign == min_prod2[2]:
                    if sign == 1:
                        if min_prod2[0][0] * norm1 * norm2 > inner_prod * inner_prod * min_prod2[0][1]:
                            min_prod2[0] = [inner_prod*inner_prod, norm1*norm2]
                            min_prod2[1] = [i, j]
                        elif min_prod2[0][0] * norm1 * norm2 == inner_prod * inner_prod * min_prod2[0][1]:
                            if min_prod2[0][1] > norm1 * norm2 or min_prod2[1] == [N+1, N+1]:
                                min_prod2[0] = [inner_prod*inner_prod, norm1*norm2]
                                min_prod2[1] = [i, j]
                    elif sign == 0:
                        if min_prod2[0][1] > norm1 * norm2 or min_prod2[1] == [N+1, N+1]:
                            min_prod2[0] = [inner_prod*inner_prod, norm1*norm2]
                            min_prod2[1] = [i, j]
                    else:
                        if min_prod2[0][0] * norm1 * norm2 < inner_prod * inner_prod * min_prod2[0][1]:
                            min_prod2[0] = [inner_prod*inner_prod, norm1*norm2]
                            min_prod2[1] = [i, j]
                        elif min_prod2[0][0] * norm1 * norm2 == inner_prod * inner_prod * min_prod2[0][1]:
                            if min_prod2[0][1] > norm1 * norm2 or min_prod2[1] == [N+1, N+1]:
                                min_prod2[0] = [inner_prod*inner_prod, norm1*norm2]
                                min_prod2[1] = [i, j]
    if flg[min_prod2[1][0]] and flg[min_prod2[1][1]]:
        break
    else:
        if flg[min_prod2[1][0]] and not flg[min_prod2[1][1]]:
            prev_point = min_prod2[1][1]
        elif not flg[min_prod2[1][0]] and flg[min_prod2[1][1]]:
            prev_point = min_prod2[1][0]
        elif not flg[min_prod2[1][0]] and not flg[min_prod2[1][1]]:
            prev_point = min_prod2[1][0]
        convex_hull.append(prev_point)
        flg[prev_point] = True
        px, py = X[prev_point][0], X[prev_point][1]
M = len(convex_hull)
prob = [0 for _ in range(N)]
for i in range(M):
    center = convex_hull[i]
    ii, jj = convex_hull[(i-1)%M], convex_hull[(i+1)%M]
    dx1 = X[ii][0] - X[center][0]
    dx2 = X[jj][0] - X[center][0]
    dy1 = X[ii][1] - X[center][1]
    dy2 = X[jj][1] - X[center][1]
    ip = dx1 * dx2 + dy1 * dy2
    n1 = dx1 * dx1 + dy1 * dy1
    n2 = dx2 * dx2 + dy2 * dy2
    n1 = n1**0.5
    n2 = n2**0.5
    prob[center] = 0.5 - (acos((ip/n1)/n2))/(2*pi)
print(prob)

Submission status: Wrong Answer

Solution code:
"""
@ 凸包をつくる
    > 凸包内部の点に属する領域は、半径Rの円からするともはやないものとして考えて良い
    > というかこの多角形自体点として考えていい！
@ 凸包の頂点vについて
    > vの両隣との傾きだけあればよい
    > その間の角度 / 360が答え
"""

from math import atan, pi, degrees

def cross3(a, b, c):
    return (b[0]-a[0])*(c[1]-a[1]) - (b[1]-a[1])*(c[0]-a[0])

def convex_hull(ps):
    qs = []
    N = len(ps)
    for p in ps:
        # 一直線上で高々2点にする場合は ">=" にする
        while len(qs) > 1 and cross3(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(N-2, -1, -1):
        p = ps[i]
        while len(qs) > t and cross3(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    return qs

def tup_to_key(tup):
    x, y = tup
    x += 10 ** 7
    y += 10 ** 7
    x *= 10 ** 8
    return x + y

def key_to_tup(key):
    x, y = divmod(key, 10 ** 8)
    x -= 10 ** 7
    y -= 10 ** 7
    return x, y

def angle(x1, y1, x2, y2):
    if y1 == y2:
        return pi / 2
    return atan(-(x1 - x2) / (y1 - y2))

if __name__ == "__main__":
    N = int(input())
    if N == 2:
        print(0.5)
        print(0.5)
        exit(0)

    res = dict()
    points = [list(map(int,input().split())) for _ in range(N)]

    sm = 0
    ps = convex_hull(sorted(points))[:-1]
    sz = len(ps)
    for i, (x, y) in enumerate(ps):
        key = tup_to_key((x, y))
        lx, ly = ps[i - 1]
        rx, ry = ps[(i + 1) % sz]
        la = angle(x, y, lx, ly)
        ra = angle(x, y, rx, ry)
        a = ra - la
        # a = min(a, 2 * pi - a)
        sm += a
        # print(x, y)
        # print(degrees(la), degrees(ra))
        # print(degrees(a))
        if a < 0:
            a += pi
        res[key] = a / (2 * pi)

    for tup in points:
        key = tup_to_key(tup)
        if key in res:
            print(res[key])
        else:
            print(0)

Submission status: Wrong Answer

Solution code:
import copy
import numpy as np

def det(p, q):
    return p[0]*q[1] - p[1]*q[0]
def sub(p, q):
    return (p[0]-q[0], p[1]-q[1])
def get_convex_hull(points):
    n = len(points)
    points.sort()
    size_convex_hull = 0
    ch = []
    for i in range(n):
        while size_convex_hull > 1:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(points[i], ch[-2])
            if det(v_cur, v_new) > 0:
                break
            size_convex_hull -= 1
            ch.pop()
        ch.append(points[i])
        size_convex_hull += 1

    t = size_convex_hull
    for i in range(n-2, -1, -1):
        while size_convex_hull > t:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(points[i], ch[-2])
            if det(v_cur, v_new) > 0:
                break
            size_convex_hull -= 1
            ch.pop()
        ch.append(points[i])
        size_convex_hull += 1

    return ch[:-1]

N,*xyf = map(int, open(0).read().split())
xy = [(xyf[i*2],xyf[i*2+1]) for i in range(N)]
xyc = copy.deepcopy(xy)
ans = [0] * (N)
ch = get_convex_hull(xyc)
ch.sort(key=lambda x:(x[0],x[1]))
chs = set(ch)
l = len(ch)
for i in range(N):
    if xy[i] in chs:
        ind = ch.index(xy[i])
        a = (ch[ind-1],ch[ind])
        b = (ch[ind],ch[(ind+1)%l])
        u = np.array([a[0][0]-a[1][0],a[1][1]-a[0][1]])
        v = np.array([b[0][0]-b[1][0],b[1][1]-b[0][1]])
        inn = np.inner(u,v)
        nor = np.linalg.norm(u) * np.linalg.norm(v)
        cos = inn / nor
        ans[i] = (np.arccos(np.clip(cos, -1.0, 1.0))/(2*np.pi))
for x in ans:
    print(x)

Submission status: Wrong Answer

Solution code:
import copy
import numpy as np

def det(p, q):
    return p[0]*q[1] - p[1]*q[0]
def sub(p, q):
    return (p[0]-q[0], p[1]-q[1])
def get_convex_hull(points):
    n = len(points)
    points.sort()
    size_convex_hull = 0
    ch = []
    for i in range(n):
        while size_convex_hull > 1:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(points[i], ch[-2])
            if det(v_cur, v_new) > 0:
                break
            size_convex_hull -= 1
            ch.pop()
        ch.append(points[i])
        size_convex_hull += 1

    t = size_convex_hull
    for i in range(n-2, -1, -1):
        while size_convex_hull > t:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(points[i], ch[-2])
            if det(v_cur, v_new) > 0:
                break
            size_convex_hull -= 1
            ch.pop()
        ch.append(points[i])
        size_convex_hull += 1

    return ch[:-1]

N,*xyf = map(int, open(0).read().split())
xy = [(xyf[i*2],xyf[i*2+1]) for i in range(N)]
xyc = copy.deepcopy(xy)
ans = [0] * (N)
ch = get_convex_hull(xyc)
ch.sort(key=lambda x:(x[0],x[1]))
chs = set(ch)
l = len(ch)
for i in range(N):
    if xy[i] in chs:
        ind = ch.index(xy[i])
        a = (ch[ind-1],ch[ind])
        b = (ch[ind],ch[(ind+1)%l])
        u = np.array([a[0][0]-a[1][0],a[1][1]-a[0][1]])
        v = np.array([b[0][0]-b[1][0],b[1][1]-b[0][1]])
        inn = np.inner(u,v)
        nor = np.linalg.norm(u) * np.linalg.norm(v)
        cos = inn / nor
        ans[i] = (np.arccos(np.clip(cos, -1.0, 1.0))/(2*np.pi)) % 1
for x in ans:
    print(x)

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    def norm2(vec):
        return math.sqrt(vec[0] ** 2 + vec[1] ** 2)
    # any 2 points must have different position.
    def ConvexHull(point_list):
        pos2idx = {point_list[i]: i for i in range(len(point_list))}
        y_val = defaultdict(list)
        x_list = sorted(list(set([p[0] for p in point_list])))
        for x, y in point_list:
            y_val[x].append(y)

        upper = [(x_list[0], max(y_val[x_list[0]]))]
        lower = [(x_list[0], min(y_val[x_list[0]]))]
        prev = float('inf')
        for xi in x_list[1:]:
            x0, y0 = upper[-1]
            x1, y1 = xi, max(y_val[xi])
            if (y1 - y0) / (x1 - x0) < prev:
                upper.append((x1, y1))
                prev = (y1 - y0) / (x1 - x0)
            else:
                while True:
                    x0, y0 = upper[-1]
                    if len(upper) == 1:
                        upper.append((x1, y1))
                        break
                    x00, y00 = upper[-2]
                    if (y1 - y0) / (x1 - x0) > (y1 - y00) / (x1 - x00):
                        upper.pop()
                    else:
                        prev = (y1 - y0) / (x1 - x0)
                        upper.append((x1, y1))
                        break

        prev = -float('inf')
        for xi in x_list[1:]:
            x0, y0 = lower[-1]
            x1, y1 = xi, min(y_val[xi])
            if (y1 - y0) / (x1 - x0) > prev:
                lower.append((x1, y1))
                prev = (y1 - y0) / (x1 - x0)
            else:
                while True:
                    x0, y0 = lower[-1]
                    if len(lower) == 1:
                        lower.append((x1, y1))
                        break
                    x00, y00 = lower[-2]
                    if (y1 - y0) / (x1 - x0) < (y1 - y00) / (x1 - x00):
                        lower.pop()
                    else:
                        prev = (y1 - y0) / (x1 - x0)
                        lower.append((x1, y1))
                        break

        # return upper, lower
        # return [pos2idx[xy] for xy in upper], [pos2idx[xy] for xy in lower]

        upper_idx, lower_idx = [pos2idx[xy] for xy in upper], [pos2idx[xy] for xy in lower]
        if upper_idx[-1] == lower_idx[-1]:
            upper_idx.pop()
        CH_idx = upper_idx
        CH_idx.extend(reversed(lower_idx))
        if CH_idx[0] == CH_idx[-1] and len(CH_idx) > 1:
            CH_idx.pop()
        return CH_idx

    def calc_deg(p,p1,p2):
        a1 = p1[0]-p[0]; a2 = p1[1]-p[1]
        b1 = p2[0]-p[0]; b2 = p2[1]-p[1]
        #print(p,p1,p2)
        #print(a1,a2,b1,b2)
        return (a1*b1+a2*b2)/(((a1**2+a2**2)**0.5)*((b1**2+b2**2)**0.5))
    N = I()
    P = [[]for _ in range(N)]
    D = defaultdict(int)
    for i in range(N):
        x,y = LI()
        P[i] = (x,y)
        D[(x,y)] = i
    C = ConvexHull(P)
    ans = [0]*N
    if len(C)==2:
        for c in C:
            ans[D[c]] = 0.5
        for v in ans:
            print(v)
        return
    #print(C)
    for i,c in enumerate(C):
        s, t, u = C[i - 1], C[i], C[(i + 1) % len(C)]
        x0, y0 = P[s]
        x1, y1 = P[t]
        x2, y2 = P[u]
        vec0 = (y0 - y1, x1 - x0)
        vec1 = (y1 - y2, x2 - x1)
        ans[t] =  math.acos((vec0[0] * vec1[0] + vec0[1] * vec1[1]) / (norm2(vec0) * norm2(vec1))) / (2 * math.pi)
    for v in ans:
        print(v)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    S = SI()
    N = len(S)
    K = I()
    dp = [[[0 for _ in range(K+1)]for _ in range(N)]for _ in range(N)]
    for i in range(N):
        for j in range(K+1):
            dp[i][i][j] = 1
    for i in range(2,N+1):
        for k in range(K+1):
            for l,r in enumerate(range(i-1,N)):
                if S[l]==S[r]:
                    dp[l][r][k] = dp[l+1][r-1][k] + 2
                else:
                    if k>0:
                        dp[l][r][k] = max(dp[l+1][r][k],dp[l][r-1][k],dp[l+1][r-1][k-1]+2)
                    else:
                        dp[l][r][k] = max(dp[l + 1][r][k], dp[l][r - 1][k])
    ans = max(dp[0][-1])
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]

if N == 2:
    print(0.5)
    print(0.5)
    exit()

outside = []
for i in range(N):
    x1, y1 = xys[i]
    for j in range(i+1, N):
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(i)
            outside.append(j)
            continue_flg = False
            break
    if continue_flg == False:
        break

go_back_to_while = False
while outside:
    i = outside[-1]
    x1, y1 = xys[i]
    for j in range(N):
        if j in outside:
            continue
        x2, y2 = xys[j]
        sign = 0
        for k, (x3, y3) in enumerate(xys):
            if k == i or k == j:
                continue
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                if x1 < x3 < x2 or x1 > x3 > x2 or y1 < y3 < y2 or y1 > y3 > y2:
                    if k in outside:
                        outside.remove(k)
                        outside.append(j)
                        go_back_to_while = True
                        break
                elif x1 < x2 < x3 or x1 > x2 > x3 or y1 < y2 < y3 or y1 > y2 > y3:
                    break
                else:
                    outside.pop() #remove i
                    go_back_to_while = True
                    break
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    break
                else:
                    continue
        else:
            outside.append(j)
            break
        if go_back_to_while:
            go_back_to_while = False
            break
    else: #when not found appropriate j
        break #get out of while True


ans = [0.0] * N

for i in range(-1, len(outside) - 1):
    x1, y1 = xys[outside[i-1]]
    x2, y2 = xys[outside[i]]
    x3, y3 = xys[outside[i+1]]
    v1x, v1y = x2 - x1, y2 - y1
    v2x, v2y = x3 - x2, y3 - y2
    dot = v1x * v2x + v1y * v2y
    len1 = (v1x ** 2 + v1y ** 2)
    len2 = (v2x ** 2 + v2y ** 2)
    ans[outside[i]] = math.acos( max(-1.0, min(1.0, dot / math.sqrt(len1 * len2))) ) / (2 * math.pi)

for a in ans:
    print('{:.20f}'.format(a))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]

if N == 2:
    print(0.5)
    print(0.5)
    exit()

outside = []
for i in range(N):
    x1, y1 = xys[i]
    for j in range(i+1, N):
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(i)
            outside.append(j)
            continue_flg = False
            break
    if continue_flg == False:
        break

delete_list = [False] * N
while True:
    i = outside[-1]
    x1, y1 = xys[i]
    for j in range(N):
        if j in outside:
            continue
        x2, y2 = xys[j]
        sign = 0
        for k, (x3, y3) in enumerate(xys):
            if k == i or k == j:
                continue
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                if x1 < x3 < x2 or x1 > x3 > x2 or y1 < y3 < y2 or y1 > y3 > y2:
                    delete_list[k] = True
                    continue
                elif x1 < x2 < x3 or x1 > x2 > x3 or y1 < y2 < y3 or y1 > y2 > y3:
                    delete_list[j] = True
                    continue
                else:
                    delete_list[i] = True
                    continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(j)
            continue_flg = False
            break
    else: #when not found appropriate j
        break #get out of while True

for i in range(N):
    if delete_list[i] and i in outside:
        outside.remove(i)

ans = [0.0] * N

for i in range(-1, len(outside) - 1):
    x1, y1 = xys[outside[i-1]]
    x2, y2 = xys[outside[i]]
    x3, y3 = xys[outside[i+1]]
    v1x, v1y = x2 - x1, y2 - y1
    v2x, v2y = x3 - x2, y3 - y2
    dot = v1x * v2x + v1y * v2y
    len1 = (v1x ** 2 + v1y ** 2)
    len2 = (v2x ** 2 + v2y ** 2)
    ans[outside[i]] = math.acos( max(-1.0, min(1.0, dot / math.sqrt(len1 * len2))) ) / (2 * math.pi)

for a in ans:
    print('{:.20f}'.format(a))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]

if N == 2:
    print(0.5)
    print(0.5)
    exit()

outside = []
for i in range(N):
    x1, y1 = xys[i]
    for j in range(i+1, N):
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(i)
            outside.append(j)
            continue_flg = False
            break
    if continue_flg == False:
        break

delete_list = [False] * N
while True:
    i = outside[-1]
    x1, y1 = xys[i]
    for j in range(N):
        if j in outside:
            continue
        x2, y2 = xys[j]
        sign = 0
        for k, (x3, y3) in enumerate(xys):
            if k == i or k == j:
                continue
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                if x1 < x3 < x2 or x1 > x3 > x2 or y1 < y3 < y2 or y1 > y3 > y2:
                    delete_list[k] = True
                    continue
                elif x1 < x2 < x3 or x1 > x2 > x3 or y1 < y2 < y3 or y1 > y2 > y3:
                    delete_list[j] = True
                    continue
                else:
                    delete_list[i] = True
                    continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(j)
            continue_flg = False
            break
    else: #when not found appropriate j
        break #get out of while True

print(outside, delete_list)

for i in range(N):
    if delete_list[i] and i in outside:
        outside.remove(i)

ans = [0.0] * N

for i in range(-1, len(outside) - 1):
    x1, y1 = xys[outside[i-1]]
    x2, y2 = xys[outside[i]]
    x3, y3 = xys[outside[i+1]]
    v1x, v1y = x2 - x1, y2 - y1
    v2x, v2y = x3 - x2, y3 - y2
    dot = v1x * v2x + v1y * v2y
    len1 = (v1x ** 2 + v1y ** 2)
    len2 = (v2x ** 2 + v2y ** 2)
    ans[outside[i]] = math.acos( max(-1.0, min(1.0, dot / math.sqrt(len1 * len2))) ) / (2 * math.pi)

for a in ans:
    print('{:.20f}'.format(a))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]

if N == 2:
    print(0.5)
    print(0.5)
    exit()

outside = []
for i in range(N):
    x1, y1 = xys[i]
    for j in range(i+1, N):
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(i)
            outside.append(j)
            continue_flg = False
            break
    if continue_flg == False:
        break

while True:
    i = outside[-1]
    x1, y1 = xys[i]
    for j in range(N):
        if j in outside:
            continue
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(j)
            continue_flg = False
            break
    else: #when not found appropriate j
        break #get out of while True

ans = [0.0] * N

for i in range(-1, len(outside) - 1):
    x1, y1 = xys[outside[i-1]]
    x2, y2 = xys[outside[i]]
    x3, y3 = xys[outside[i+1]]
    v1x, v1y = x2 - x1, y2 - y1
    v2x, v2y = x3 - x2, y3 - y2
    dot = v1x * v2x + v1y * v2y
    len1 = (v1x ** 2 + v1y ** 2)
    len2 = (v2x ** 2 + v2y ** 2)
    ans[outside[i]] = math.acos( max(-1.0, min(1.0, dot / math.sqrt(len1 * len2))) ) / (2 * math.pi)

for a in ans:
    print('{:.20f}'.format(a))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]

if N == 2:
    print(0.5)
    print(0.5)
    exit()

outside = []
for i in range(N):
    x1, y1 = xys[i]
    for j in range(i+1, N):
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(i)
            outside.append(j)
            continue_flg = False
            break
    if continue_flg == False:
        break

while True:
    i = outside[-1]
    x1, y1 = xys[i]
    for j in range(N):
        if j in outside:
            continue
        x2, y2 = xys[j]
        sign = 0
        for x3, y3 in xys:
            tmp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
            if tmp == 0:
                continue
            elif tmp > 0:
                if sign == 0:
                    sign = +1
                elif sign == -1:
                    continue_flg = True
                    break
                else:
                    continue
            else:
                if sign == 0:
                    sign = -1
                elif sign == +1:
                    continue_flg = True
                    break
                else:
                    continue
        else:
            outside.append(j)
            continue_flg = False
            break
    else: #when not found appropriate j
        break #get out of while True

ans = [0.0] * N

for i in range(-1, len(outside) - 1):
    x1, y1 = xys[outside[i-1]]
    x2, y2 = xys[outside[i]]
    x3, y3 = xys[outside[i+1]]
    v1x, v1y = x2 - x1, y2 - y1
    v2x, v2y = x3 - x2, y3 - y2
    dot = v1x * v2x + v1y * v2y
    len1 = (v1x ** 2 + v1y ** 2) ** 0.5
    len2 = (v2x ** 2 + v2y ** 2) ** 0.5
    ans[outside[i]] = math.acos( max(-1.0, min(1.0, dot / (len1 * len2))) ) / (2 * math.pi)

for a in ans:
    print('{:.20f}'.format(a))