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:
import math
N = int(input())
H = [list(map(int, input().split())) for i in range(N)]
P = [[0, 2*math.pi] for i in range(N)]
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        rad = math.atan2(H[i][1]-H[j][1], H[i][0]-H[j][0])
        mi = (rad - math.pi/2) % (2*math.pi)
        ma = (rad + math.pi/2) % (2*math.pi)
        if ma > mi:
            if P[i][0] >= P[i][1]:
                if mi < P[i][1]:
                    P[i] = [mi, P[i][1]]
                elif ma > P[i][0]:
                    P[i] = [P[i][0], ma]
                else:
                    P[i] = [0, 0]
                    break
            else:
                P[i] = [max(P[i][0], mi), min(P[i][1], ma)]
                if P[i][0] >= P[i][1]:
                    P[i] = [0, 0]
                    break
        else:
            if P[i][0] >= P[i][1]:
                P[i] = [max(P[i][0], mi), min(P[i][1], ma)]
            elif P[i] == [0, 2*math.pi]:
                P[i] = [mi, ma]
            else:
                if mi < P[i][1]:
                    if mi < P[i][0]:
                        continue
                    else:
                        P[i] = [mi, P[i][1]]
                elif ma > P[i][0]:
                    if ma > P[i][1]:
                        continue
                    else:
                        P[i] = [P[i][0], ma]
                else:
                    P[i] = [0, 0]
                    break
print(P)
for p in P:
    print((p[1]-p[0]) / (2*math.pi) % 1)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
H = [list(map(int, input().split())) for i in range(N)]
P = [[0, 2*math.pi] for i in range(N)]
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        rad = math.atan2(H[i][1]-H[j][1], H[i][0]-H[j][0])
        mi = (rad - math.pi/2) % (2*math.pi)
        ma = (rad + math.pi/2) % (2*math.pi)
        if ma > mi:
            if P[i][0] >= P[i][1]:
                if mi < P[i][1]:
                    P[i] = [mi, P[i][1]]
                elif ma > P[i][0]:
                    P[i] = [P[i][0], ma]
                else:
                    P[i] = [0, 0]
                    break
            else:
                P[i] = [max(P[i][0], mi), min(P[i][1], ma)]
                if P[i][0] >= P[i][1]:
                    P[i] = [0, 0]
                    break
        else:
            if P[i][0] >= P[i][1]:
                P[i] = [max(P[i][0], mi), min(P[i][1], ma)]
            elif P[i] == [0, 2*math.pi]:
                P[i] = [mi, ma]
            else:
                if mi < P[i][1]:
                    P[i] = [mi, P[i][1]]
                elif ma > P[i][0]:
                    P[i] = [P[i][0], ma]
                else:
                    P[i] = [0, 0]
                    break
for p in P:
    print((p[1]-p[0]) / (2*math.pi) % 1)

Submission status: Wrong Answer

Solution code:
from numpy import argmax
import numpy as np
from collections import defaultdict


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

n = int(input())
H = [np.array([int(j) for j in input().split()]) for i in range(n)]

if n == 1:
    print(1)
    exit()
# else n == 2:
#     print(0.5)
#     print(0.5)
#     exit()

convex = [min(H, key=lambda x:x[1])]

for i in range(n):
    a = H[0] if (H[0] != convex[-1]).any() else H[-1]
    for b in H:
        if cross(a-convex[-1], b-convex[-1]) < 0:
            a = b
    if (a == convex[0]).all():
        break
    convex.append(a)

ans = defaultdict(float)

for c, a, b in zip([convex[-1]]+convex[:-1], convex, convex[1:] + [convex[0]]):
    ca = c-a
    ba = b-a
    i = np.inner(ca, ba)
    n = np.linalg.norm(ca) * np.linalg.norm(ba)
    ans[tuple(a)] = (np.pi - np.arccos(np.clip(i/n, -1, 1))) / (2*np.pi)

for i in H:
    print(ans[tuple(i)])
# for i in range(n):
#  a = convex[-2] - convex[-1]
#  convex.append(H(argmax([cross(a, b-convex[-1]) for b in H]))

Submission status: Wrong Answer

Solution code:
from numpy import argmax
import numpy as np
from collections import defaultdict


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

n = int(input())
if n == 1:
    print(1)
    exit()
# else n == 2:
#     print(0.5)
#     print(0.5)
#     exit()

H = [np.array([int(j) for j in input().split()]) for i in range(n)]

convex = [min(H, key=lambda x:x[1])]

for i in range(n):
    a = H[0] if (H[0] != convex[-1]).any() else H[-1]
    for b in H:
        if cross(a-convex[-1], b-convex[-1]) < 0:
            a = b
    if (a == convex[0]).all():
        break
    convex.append(a)

ans = defaultdict(float)

for c, a, b in zip([convex[-1]]+convex[:-1], convex, convex[1:] + [convex[0]]):
    ca = c-a
    ba = b-a
    i = np.inner(ca, ba)
    n = np.linalg.norm(ca) * np.linalg.norm(ba)
    ac = np.pi - np.arccos(i/n)
    ans[tuple(a)] = (np.pi - np.arccos(i/n)) / (2*np.pi)

for i in H:
    print(ans[tuple(i)])
# for i in range(n):
#  a = convex[-2] - convex[-1]
#  convex.append(H(argmax([cross(a, b-convex[-1]) for b in H]))

Submission status: Wrong Answer

Solution code:
from collections import Counter

import numpy as np


def solve(n, pts):
    ans = [0] * n

    div = 200000
    a = np.linspace(0, 2 * np.pi, div, endpoint=False)
    b = np.dot(pts, np.array([np.cos(a), np.sin(a)], dtype=np.float16))
    for i, v in Counter(np.argmax(b, axis=0)).items():
        ans[i] = v / div
    return ans


n = int(input())
pts = np.array([list(map(int, input().split())) for _ in range(n)], dtype=np.float16)
print('\n'.join(map(str, solve(n, pts))))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ps = []
minx = float('inf')
miny = float('inf')
mini = None
for i in range(N):
  x, y = map(int, input().split())
  if x < minx or (x == minx and y < miny):
    minx, miny, mini = x, y, i
  ps.append((x, y))

if len(ps) == 2:
  print(0.5)
  print(0.5)
  exit()

# i -> j 方向に2点を結ぶ単位ベクトルを返す
def divvector(xi, yi, xj, yj):
  if xi == xj:
    if yj > yi: return (0, 1)
    else: return (0, -1)
  dx, dy = xj-xi, yj-yi
  dz = math.sqrt(dx**2 + dy**2)
  return (dx/dz, dy/dz)

# p1 -> p0 -> p2 が時計回りかどうか
def clockwise(x0, y0, x1, y1, x2, y2):
  return (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0) <= 0

# 反時計回りに、凸包を求める
# 各頂点について、隣の頂点との二等分線のなす角が、落ちる確率となる
# だが、頂点から出る2辺の角と同じ大きさなのでそっちを計算
first = now = mini
convexs = [now]
divvecs = { now: [] }
end = False
while not end:
  xnow, ynow = ps[now]
  for j in range(N):
    if j == now or j != first and j in divvecs: continue
    xj, yj = ps[j]
    for k in range(N):
      if k == now or k == j: continue
      if not clockwise(xj, yj, xnow, ynow, ps[k][0], ps[k][1]):
        break
    else:
      convexs.append(j)
      divv = divvector(xnow, ynow, xj, yj)
      if j not in divvecs:
        divvecs[j] = []
      divvecs[j].append(divv)
      divvecs[now].append(divv)
      now = j
      if now == first:
        end = True
      break

# 凸包を構成する各頂点について、
# 隣の頂点との二等分線のなす角を360度で割ったものが確率
# 凸包を構成しない点については、確率はほぼ0
for i in range(N):
  if i not in convexs:
    print(0)
    continue
  v1, v2 = divvecs[i]
  # すでに単位ベクトルになっているので、cos = 内積
  cos = max(-1, min(1, v1[0]*v2[0] + v1[1]*v2[1]))
  print(round(math.acos(cos) / (2*math.pi), 8))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ps = []
minx = float('inf')
miny = float('inf')
mini = None
for i in range(N):
  x, y = map(int, input().split())
  if x < minx or (x == minx and y < miny):
    minx, miny, mini = x, y, i
  ps.append((x, y))

if len(ps) == 2:
  print(0.5)
  print(0.5)
  exit()

# i -> j 方向に2点を結ぶ単位ベクトルを返す
def divvector(xi, yi, xj, yj):
  if xi == xj:
    if yj > yi: return (0, 1)
    else: return (0, -1)
  dx, dy = xj-xi, yj-yi
  dz = math.sqrt(dx**2 + dy**2)
  return (dx/dz, dy/dz)

# p1 -> p0 -> p2 が時計回りかどうか
def clockwise(x0, y0, x1, y1, x2, y2):
  return (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0) <= 0

# 反時計回りに、凸包を求める
# 各頂点について、隣の頂点との二等分線のなす角が、落ちる確率となる
# だが、頂点から出る2辺の角と同じ大きさなのでそっちを計算
first = now = mini
convexs = [now]
divvecs = { now: [] }
end = False
while not end:
  xnow, ynow = ps[now]
  for j in range(N):
    if j == now or j != first and j in divvecs: continue
    xj, yj = ps[j]
    for k in range(N):
      if k == now or k == j: continue
      if not clockwise(xj, yj, xnow, ynow, ps[k][0], ps[k][1]):
        break
    else:
      convexs.append(j)
      divv = divvector(xnow, ynow, xj, yj)
      if j not in divvecs:
        divvecs[j] = []
      divvecs[j].append(divv)
      divvecs[now].append(divv)
      now = j
      if now == first:
        end = True
      break

# 凸包を構成する各頂点について、
# 隣の頂点との二等分線のなす角を360度で割ったものが確率
# 凸包を構成しない点については、確率はほぼ0
for i in range(N):
  if i not in convexs:
    print(0)
    continue
  v1, v2 = divvecs[i]
  # すでに単位ベクトルになっているので、cos = 内積
  cos = min(1, v1[0]*v2[0] + v1[1]*v2[1])
  print(math.acos(cos) / (2*math.pi))

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

p = 2.5e5/2
n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
ans = np.zeros(n)

a1 = np.linspace(0, np.pi, p, endpoint=False)
a2 = np.linspace(np.pi, np.pi*2, p, endpoint=False)

for i, v in Counter(np.argmax(np.dot(pts, [np.sin(a1), np.cos(a1)]), axis=0)).items():
  ans[i] += v / p
for i, v in Counter(np.argmax(np.dot(pts, [np.sin(a2), np.cos(a2)]), axis=0)).items():
  ans[i] += v / p
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
from collections import Counter

import numpy as np


def solve(n, pts):
    ans = [0] * n

    div = 150000
    a = np.linspace(0, 2 * np.pi, div)
    b = np.dot(pts, [np.sin(a), np.cos(a)])
    c = np.argmax(b, axis=0)
    for i, v in Counter(c).items():
        ans[i] = v / div
    return ans


n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
print('\n'.join(map(str, solve(n, pts))))

Submission status: Wrong Answer

Solution code:
from collections import Counter

import numpy as np


def solve(n, pts):
    ans = [0] * n

    div = 140000
    a = np.linspace(0, 2 * np.pi, div)
    b = np.dot(pts, [np.sin(a), np.cos(a)])
    c = np.argmax(b, axis=0)
    for i, v in Counter(c).items():
        ans[i] = v / div
    return ans


n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
print('\n'.join(map(str, solve(n, pts))))

Submission status: Wrong Answer

Solution code:
from collections import Counter

import numpy as np


def solve(n, pts):
    ans = [0] * n

    div = 100000
    a = np.linspace(0, 2 * np.pi, div)
    b = np.dot(pts, [np.sin(a), np.cos(a)])
    c = np.argmax(b, axis=0)
    for i, v in Counter(c).items():
        ans[i] = v / div
    return ans


n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
print('\n'.join(map(str, solve(n, pts))))

Submission status: Wrong Answer

Solution code:
import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError


def solve(n, pts):
    if n == 2:
        return [0.5, 0.5]

    ans = [0] * n

    try:
        hull = ConvexHull(pts)
    except QhullError:
        lm = np.argmin(pts, axis=0)[0]
        rm = np.argmax(pts, axis=0)[0]
        ans[lm] = ans[rm] = 0.5
        return ans

    ps = np.array(list(map(pts.__getitem__, hull.vertices)))
    vs = ps - np.roll(ps, 1, axis=0)

    vt = vs.T
    vt[0] *= -1
    arcs = np.arctan2(*vt)
    arcs = np.append(arcs, arcs[0])
    da = np.diff(arcs) / (2 * np.pi) % 1

    for i, a in zip(hull.vertices, da):
        ans[i] = a

    return ans


n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
print('\n'.join(map(str, solve(n, pts))), end='')

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(t):
    j = 0
    for i in range(N):
        if x[i]*math.sin(t)+y[i]*math.cos(t)<x[j]*math.sin(t)+y[i]*math.cos(t):
            j = i
    return j


r = [0 for i in range(N)]
M = 2500000
for i in range(M):
    k = mindis(2*math.pi*i/M)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(t):
    j = 0
    for i in range(N):
        if x[i]*math.cos(t)+y[i]*math.sin(t)<x[j]*math.cos(t)+y[i]*math.sin(t):
            j = i
    return j


r = [0 for i in range(N)]
M = 250000
for i in range(M):
    k = mindis(2*math.pi*i/M)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(t):
    j = 0
    for i in range(N):
        if x[i]*math.sin(t)+y[i]*math.cos(t)<x[j]*math.sin(t)+y[i]*math.cos(t):
            j = i
    return j


r = [0 for i in range(N)]
M = 250000
for i in range(M):
    k = mindis(2*math.pi*i/M)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 17*10**5
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**10
    s = math.sin(2*math.pi*i/M)*10**10
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 15*10**5
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**10
    s = math.sin(2*math.pi*i/M)*10**10
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 10*10**5
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**10
    s = math.sin(2*math.pi*i/M)*10**10
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
na=np.array([list(map(int,input().split())) for i in range(n)])
t=1000000
q=100
l =np.pi * 2 /t
ql=np.pi * 2 /t
b=np.array([0 for i in range(n)])
x0=0
for i in range(q):
  nr=np.array([np.cos(i*ql)*(10**12),np.sin(i*ql)*(10**12)])
  m=float('inf')
  for j in range(len(na)):
    l=np.linalg.norm(na[j]-nr)
    if l<m:
      x=j
      m=l
  if x==x0:
    b[x]+=t/q
  else:
    for i0 in range(q-1,q):
      nr=np.array([np.cos(i0*l)*(10**12),np.sin(i0*l)*(10**12)])
      m=float('inf')
      for j in range(len(na)):
        l=np.linalg.norm(na[j]-nr)
        if l<m:
          x=j
          m=l
    b[x]+=1
  x0=x

s=sum(b)
for i in range(n):
  print(b[i]/s)

Submission status: Wrong Answer

Solution code:
import math
def solve():
    N = int(input())
    clist = []
    dist = {}
    for i in range(N):
        x,y = map(int,input().split())
        clist.append((x,y))
        dist[i] = 0
    num = 30000
    calc(dist,clist,num)
    for i in range (N):
        print(str(dist[i]))

def dotprod(theta,x,y):
    return math.cos(theta)*x + math.sin(theta)*y

def prefered(theta,li):
    i = 0
    max = -10000000000
    min = 10000000000
    maxi = -1
    mini = -1
    for (x,y) in li:
        cand = dotprod(theta,x,y) 
        if cand > max:
            max = cand
            maxi = i
        if cand < min:
            min = cand
            mini = i
        i += 1
    return maxi,mini


def calc(d,li,number):
    for k in range(number):
        theta = math.pi * (k/number)
        maxi,mini = prefered(theta,li)
        d[maxi] += 1
        d[mini] += 1

    for key in d:
        d[key] = d[key]/(2*number)

solve()

Submission status: Wrong Answer

Solution code:
import math
def solve():
    N = int(input())
    clist = []
    dist = {}
    for i in range(N):
        x,y = map(int,input().split())
        clist.append((x,y))
        dist[i] = 0
    num = 10000
    calc(dist,clist,num)
    for i in range (N):
        print(str(dist[i]))

def dotprod(theta,x,y):
    return math.cos(theta)*x + math.sin(theta)*y

def prefered(theta,li):
    i = 0
    max = -10000000000
    min = 10000000000
    maxi = -1
    mini = -1
    for (x,y) in li:
        cand = dotprod(theta,x,y) 
        if cand > max:
            max = cand
            maxi = i
        if cand < min:
            min = cand
            mini = i
        i += 1
    return maxi,mini


def calc(d,li,number):
    for k in range(number):
        theta = math.pi * (k/number)
        maxi,mini = prefered(theta,li)
        d[maxi] += 1
        d[mini] += 1

    for key in d:
        d[key] = d[key]/(2*number)

solve()

Submission status: Wrong Answer

Solution code:
from math import acos, hypot, pi


class Point:
    def __init__(self, i, x, y):
        self.i = i
        self.x = int(x)
        self.y = int(y)


class Line:
    def __init__(self, p1, p2):
        self.p1 = p1
        self.p2 = p2
        self.d2 = (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2
        if p1.x == p2.x:
            self.a = 1
            self.b = 0
        else:
            self.a = p2.y - p1.y
            self.b = p1.x - p2.x
        self.c = -p1.y * self.b - p1.x * self.a

    def dist(self, p):
        f = self.a * p.x + self.b * p.y + self.c
        if f == 0:
            d12 = (self.p1.x - p.x) ** 2 + (self.p1.y - p.y) ** 2
            d22 = (self.p2.x - p.x) ** 2 + (self.p2.y - p.y) ** 2
            if self.d2 < max(d12, d22):
                return None
            return 0
        if f < 0:
            return -1
        else:
            return 1

    def kaku(self, other):
        x = self.a * other.a + self.b * other.b
        x /= hypot(self.a, self.b) * hypot(other.a, other.b)
        return pi - acos(x)


def make_p(n, pp):
    pids = {p.i: [] for p in pp}
    for i in range(n):
        if len(pids[i]) == 2:
            continue
        p1 = pp[i]
        for j in pids:
            if i == j or len(pids[j]) == 2:
                continue
            p2 = pp[j]
            line = Line(p1, p2)
            ptype = {0: 0, 1: 0, -1: 0, None: 0}
            for k in pids:
                if k == i or k == j:
                    continue
                ptype[line.dist(pp[k])] += 1
            if ptype[None]:
                continue
            if ptype[1] == 0 or ptype[-1] == 0:
                pids[i].append(j)
                pids[j].append(i)
    return pids


def main():
    n = int(input())
    if n == 2:
        print(0.5)
        print(0.5)
        return
    pp = []
    for i in range(n):
        p = Point(i, *input().split())
        pp.append(p)
    pids = make_p(n, pp)
    prob = [0.0] * n
    for i, nei in pids.items():
        if len(nei) == 2:
            l1 = Line(pp[i], pp[nei[0]])
            l2 = Line(pp[i], pp[nei[1]])
            kaku = l1.kaku(l2)
            prob[i] += kaku / (2 * pi)
    for p in prob:
        print(p)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

N = int(input())

xy = np.zeros(N*2)
n = 0
for i in range(0,N):
    a,b = map(int,input().split())
    xy[n] = a
    n = n + 1
    xy[n] = b
    n = n + 1

xy = xy.reshape((N,2))

R = 10*10*10*10

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
X = []
Y = []
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
for i in range(N):
    r_min = - 2 * math.pi
    r_max = 2 * math.pi
    for j in range(N):
        if i == j:
            continue
        r = math.atan2(Y[j] - Y[i], X[j] - X[i])
        if Y[j] >= Y[i] and X[j] <= X[i]:
            r -= 2.0 * math.pi
        r += math.pi / 2.0
        r_min = max(r_min, r)
        r_max = min(r_max, r + math.pi)
    print((r_max - r_min) / (2.0 * math.pi) if r_max > r_min else 0.0)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    N = int(input())
    xy = []
    for i in range(N):
        xy.append(list(map(int, (input().split(' ')))))
    for i in range(N):
        print(0.5)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
X = []
Y = []
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
for i in range(N):
    r_min = - 2 * math.pi
    r_max = 2 * math.pi
    for j in range(N):
        if i == j:
            continue
        r = math.atan2(Y[j] - Y[i], X[j] - X[i]) + math.pi / 2.0
        if r >= math.pi:
            r -= 2.0 * math.pi
        r_min = max(r_min, r)
        r_max = min(r_max, r + math.pi)
    print((r_max - r_min) / (2.0 * math.pi) if r_max > r_min else 0.0)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
X = []
Y = []
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
for i in range(N):
    r_min = - 2 * math.pi
    r_max = 2 * math.pi
    for j in range(N):
        if i == j:
            continue
        r = math.atan2(Y[j] - Y[i], X[j] - X[i]) + math.pi / 2.0
        if r >= math.pi:
            r -= 2.0 * math.pi
        r_min = max(r_min, r)
        r_max = min(r_max, r + math.pi)
    print((r_max - r_min) / (2.0 * math.pi) if r_max > r_min else 0)

Submission status: Wrong Answer

Solution code:
import math

N=int(input())

PI = math.pi

X=[]
Y=[]
for i in range(N):
    x,y=[int(i) for i in input().split()]
    X.append(x)
    Y.append(y)

for i in range(N):
    kakudo = [math.atan2(Y[i]-Y[j],X[i]-X[j]) for j in range(N) if j != i]
    kakudo.sort()
    print(kakudo)
    kmax = 0
    if N == 2:
        kmax = 2*PI
    else:
        for j in range(N-2):
            kmax = max(kmax,kakudo[j+1] - kakudo[j])
            kmax = max(kmax, kakudo[0] + 2*PI - kakudo[N-2])
    print(max(0,kmax-PI)/(2*PI))

#print(math.atan2(0,0))

Submission status: Wrong Answer

Solution code:
import math
def solve():
    N = int(input())
    clist = []
    dist = {}
    for i in range(N):
        x,y = map(int,input().split())
        clist.append((x,y))
        dist[i] = 0
    num = 50000
    calc(dist,clist,num)
    for i in range (N):
        print(str(dist[i]))

def dotprod(theta,x,y):
    return math.cos(theta)*x + math.sin(theta)*y

def prefered(theta,li):
    i = 0
    max = -10000000000
    maxi = -1
    for (x,y) in li:
        cand = dotprod(theta,x,y) 
        if cand > max:
            max = cand
            maxi = i
        i += 1
    return maxi

def calc(d,li,number):
    for k in range(number):
        theta = 2 * math.pi * (k/number)
        d[prefered(theta,li)] += 1

    for key in d:
        d[key] = d[key]/number

solve()

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 5*10**5
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**10
    s = math.sin(2*math.pi*i/M)*10**10
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 10**5
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**8
    s = math.sin(2*math.pi*i/M)*10**8
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 10**4
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**8
    s = math.sin(2*math.pi*i/M)*10**8
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 10**4
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**8
    s = math.sin(2*math.pi*i/M)*10**8
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
print(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
    x[i], y[i] = map(int, input().split())


def mindis(p, q):
    j = 0
    for i in range(N):
        if (x[i]-p)**2+(y[i]-q)**2<(x[j]-p)**2+(y[j]-q)**2:
            j = i
    return j


r = [0 for i in range(N)]
M = 10**5
for i in range(M):
    c = math.cos(2*math.pi*i/M)*10**8
    s = math.sin(2*math.pi*i/M)*10**8
    k = mindis(c, s)
    r[k] += 1
S = sum(r)
print(r)
for i in range(N):
    print(r[i]/S)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
  print('nan')

Submission status: Time Limit Exceeded

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 i == j:
            continue
        if outside[-2] == j:
            continue
        if outside[0] == j:
            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( dot / (len1 * len2) ) / (2 * math.pi) # = 2pi

print(*ans, sep = '\n')

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
L = [0]*N
def rotate(x,y,i):
  cos = np.cos(1+np.pi*i/50000)
  sin = np.sin(1+np.pi*i/50000)
  return x*cos-y*sin

for i in range(N):
  x, y = (int(i) for i in input().split())
  L[i] = (x, y)

res = [0]*N
for i in range(100000):
  ma = -1
  mav = -float("inf")
  for j in range(N):
    x, y = L[j]
    d = rotate(x,y,i)
    if d > mav:
      ma = j
      mav = d
  res[ma] += 0.00001
for re in res:
  print(re)

Submission status: Time Limit Exceeded

Solution code:
import math


def solve(n, pts):
    ans = [0] * n
    _sin, _cos = math.sin, math.cos

    div = 200000
    pi2 = math.pi * 2
    for k in range(div):
        a = pi2 * k / div
        tmp_max, tmp_i = 0, 0
        for i, (x, y) in enumerate(pts):
            b = x * _sin(a) + y * _cos(a)
            if tmp_max < b:
                tmp_max, tmp_i = b, i
        ans[tmp_i] += 1
    return [v / div for v in ans]


n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
print('\n'.join(map(str, solve(n, pts))))