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
pi=3.141592657589793238462643383279

#quoted from https://atcoder.jp/contests/agc021/submissions/2436528
def cross(C, A, B):
    return (C[0] - A[0])*(C[1] - B[1]) - (C[1] - A[1])*(C[0] - B[0])

def convex_hull(P):
    P.sort()
    Q = []
    for p in P:
        while 1 < len(Q) and cross(Q[-2], Q[-1], p) >= 0:
            Q.pop()
        Q.append(p)
    k = len(Q)
    for p in reversed(P[:-1]):
        while k < len(Q) and cross(Q[-2], Q[-1], p) >= 0:
            Q.pop()
        Q.append(p)
    return Q

n=int(input())
arr=[]
for _ in range(n):
  x,y=map(int,input().split())
  arr.append((x,y))
arr2=convex_hull(arr[:])[:-1]
ans=[0]*n
if n==2:
  print(0.5)
  print(0.5)
else:
  for i in range(n):
    pos=arr[i]
    if pos not in arr2:
      continue
    else:
      idx=arr2.index(pos)
      pos1=arr2[idx-1]
      pos2=arr2[(idx+1)%len(arr2)]
      x1=pos[0]-pos1[0]
      y1=pos[1]-pos1[1]
      x2=pos2[0]-pos[0]
      y2=pos2[1]-pos[1]
      angle=abs(math.atan2(x1*y2-x2*y1,x1*x2+y1*y2))
      ans[i]=angle/(2*pi)
  print(ans)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
pi=math.pi
hl=[[pi,0,0,-pi] for i in range(n)]
for i in range(n):
    x1,y1=l[i]
    for j in range(i+1,n):
        x2,y2=l[j]
        if x1==x2:
            if y1>y2:
                hl[i][3]=0
                hl[j][0]=0
            else:
                hl[j][3]=0
                hl[i][3]=0
        else:
            r=math.atan((y2-y1)/(x2-x1))+pi/2
            if x2>x1:
                hl[j][3]=max(hl[j][3],r-pi)
                hl[j][0]=min(hl[j][0],r)
                hl[i][1]=max(hl[i][1],r)
                hl[i][2]=min(hl[i][2],r-pi)
            else:
                hl[i][3]=max(hl[i][3],r-pi)
                hl[i][0]=min(hl[i][0],r)
                hl[j][1]=max(hl[j][1],r)
                hl[j][2]=min(hl[j][2],r-pi)
for i in hl:
    a,b,c,d=i
    print((max(0,a-b)+max(0,c-d))/(2*pi))

Submission status: Wrong Answer

Solution code:
def convex_hull(inlist):
    inlist = sorted(inlist)
    x_min, x_max = inlist[0], inlist[-1]

    def cross_product(p1,p2,p3):
        return (p2[0]-p1[0])*(p3[1]-p1[1])-(p2[1]-p1[1])*(p3[0]-p1[0])

    upper_list = [x_min]
    downer_list = [x_min]
    for i in inlist:
        if cross_product(x_min,i,x_max) < 0:
            upper_list.append(i)
        elif cross_product(x_min,i,x_max) > 0:
            downer_list.append(i)
    upper_list.append(x_max)
    downer_list.append(x_max)

    upper_convex_hull = upper_list[:2]
    if len(upper_list) > 2:
        for i in range(len(upper_list)-2):
            upper_convex_hull.append(upper_list[i+2])
            if cross_product(upper_convex_hull[-3],upper_convex_hull[-2],upper_convex_hull[-1]) >= 0:
                del upper_convex_hull[-2]

    downer_convex_hull = downer_list[:2]
    if len(downer_list) > 2:
        for i in range(len(downer_list)-2):
            downer_convex_hull.append(downer_list[i+2])
            if cross_product(downer_convex_hull[-3],downer_convex_hull[-2],downer_convex_hull[-1]) <= 0:
                del downer_convex_hull[-2]


    outlist = upper_convex_hull + list(reversed(downer_convex_hull[1:-1]))
    return outlist

import math

def atan_two_points(p1,p2):
    y = p2[1] - p1[1]
    x = p2[0] - p1[0]
    return math.atan2(y,x)

n = int(input())
point_list = [ [ int(v) for v in input().split() ] for i in range(n) ]

convex_hull_point_list = convex_hull(point_list)
convex_hull_point_list.append(convex_hull_point_list[0])

convex_hull_angle_list  = [ atan_two_points(convex_hull_point_list[i],convex_hull_point_list[i+1]) for i in range(len(convex_hull_point_list)-1) ]

convex_hull_ratio_list = []
convex_hull_ratio_list.append(abs((2*math.pi - convex_hull_angle_list[0] + convex_hull_angle_list[-1])/(2*math.pi)))
for i in range(len(convex_hull_angle_list)-1):
    convex_hull_ratio_list.append(abs((convex_hull_angle_list[i+1]- convex_hull_angle_list[i])/(2*math.pi)))
del convex_hull_point_list[-1]

l_con = len(convex_hull_point_list)

for i in point_list:

    if i in convex_hull_point_list:
        print(convex_hull_ratio_list[convex_hull_point_list.index(i)])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def is_turn_right(p1, p2, p3):
    x1, y1 = p1
    x2, y2 = p2
    x3, y3 = p3
    return (y3 - y1) * (x2 - x1) < (y2 - y1) * (x3 - x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if not is_turn_right(upper[-2], upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if not is_turn_right(lower[-2], lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    ch += ch[:2]
    for i in range(1, M+1):
        a1 = angle(ch[i-1], ch[i])
        a2 = angle(ch[i], ch[i+1])
        ratio = ((a1-a2) / (math.pi*2)) % 1.0
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def is_turn_right(p1, p2, p3):
    x1, y1 = p1
    x2, y2 = p2
    x3, y3 = p3
    return (y3 - y1) * (x2 - x1) < (y2 - y1) * (x3 - x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if not is_turn_right(upper[-2], upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if not is_turn_right(lower[-2], lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    ch += ch[:2]
    for i in range(1, M+1):
        a1 = angle(ch[i-1], ch[i])
        a2 = angle(ch[i], ch[i+1])
        ratio = (a1-a2) / (math.pi*2)
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def is_turn_right(p1, p2, p3):
    x1, y1 = p1
    x2, y2 = p2
    x3, y3 = p3
    return (y3 - y1) * (x2 - x1) < (y2 - y1) * (x3 - x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if not is_turn_right(upper[-2], upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if not is_turn_right(lower[-2], lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = angle(ch[i], ch[(i-1) % M]) - math.pi / 2
        a2 = angle(ch[i], ch[(i+1) % M]) + math.pi / 2
        ratio = ((a1-a2) / (math.pi*2)) % 1.0
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1, _ = p1
    x2, y2, _ = p2
    return math.atan2(y2-y1, x2-x1)


def is_turn_right(p1, p2, p3):
    return (p3[1] - p1[1]) * (p2[0] - p1[0]) > (p2[1] - p1[1]) * (p3[0] - p1[0])


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if is_turn_right(upper[-2], upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if is_turn_right(lower[-2], lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y, i)
    ans = [0.0] * N
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = angle(ch[i], ch[(i-1) % M]) - math.pi / 2
        a2 = angle(ch[i], ch[(i+1) % M]) + math.pi / 2
        ratio = ((a1-a2) / (math.pi*2)) % 1.0
        ans[ch[i][2]] = ratio
    for a in ans:
        print(a)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def is_turn_right(p1, p2, p3):
    x1, y1 = p1
    x2, y2 = p2
    x3, y3 = p3
    return (y3 - y1) * (x2 - x1) > (y2 - y1) * (x3 - x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if is_turn_right(upper[-2], upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if is_turn_right(lower[-2], lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = angle(ch[i], ch[(i-1) % M]) - math.pi / 2
        a2 = angle(ch[i], ch[(i+1) % M]) + math.pi / 2
        ratio = ((a1-a2) / (math.pi*2)) % 1.0
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def is_turn_right(p1, p2, p3):
    x1, y1 = p1
    x2, y2 = p2
    x3, y3 = p3
    return (y3 - y1) * (x2 - x1) > (y2 - y1) * (x3 - x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if is_turn_right(upper[-2], upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if is_turn_right(lower[-2], lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = (angle(ch[i], ch[(i-1) % M]) - math.pi / 2) % (math.pi*2)
        a2 = (angle(ch[i], ch[(i+1) % M]) + math.pi / 2) % (math.pi*2)
        ratio = ((a1-a2) % (math.pi*2)) / (math.pi*2)
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if angle(upper[-2], upper[-1]) <= angle(upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if angle(lower[-2], lower[-1]) >= angle(lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = (angle(ch[i], ch[(i-1) % M]) - math.pi / 2) % (math.pi*2)
        a2 = (angle(ch[i], ch[(i+1) % M]) + math.pi / 2) % (math.pi*2)
        ratio = ((a1-a2) % (math.pi*2)) / (math.pi*2)
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if angle(upper[-2], upper[-1]) < angle(upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if angle(lower[-2], lower[-1]) > angle(lower[-1], p):
            lower.pop()
        lower.append(p)
    if upper[-1] == lower[0]:
        upper = upper[:-1]
    if upper[0] == lower[-1]:
        lower = lower[:-1]
    ans = upper + lower
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = (angle(ch[i], ch[(i-1) % M]) - math.pi / 2) % (math.pi*2)
        a2 = (angle(ch[i], ch[(i+1) % M]) + math.pi / 2) % (math.pi*2)
        ratio = ((a1-a2) % (math.pi*2)) / (math.pi*2)
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math


def angle(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.atan2(y2-y1, x2-x1)


def find_convex_hull(points):
    if len(points) < 2:
        return points
    P = sorted(points)
    upper = [P[0], P[1]]
    for p in P[2:]:
        if angle(upper[-2], upper[-1]) < angle(upper[-1], p):
            upper.pop()
        upper.append(p)
    lower = [P[-1], P[-2]]
    for p in reversed(P[:-2]):
        if angle(lower[-2], lower[-1]) > angle(lower[-1], p):
            lower.pop()
        lower.append(p)
    ans = upper + list(reversed(lower[1:-1]))
    return ans


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = {p: 0.0 for p in P}
    ch = find_convex_hull(P)
    M = len(ch)
    for i in range(M):
        a1 = (angle(ch[i], ch[(i-1) % M]) - math.pi / 2) % (math.pi*2)
        a2 = (angle(ch[i], ch[(i+1) % M]) + math.pi / 2) % (math.pi*2)
        ratio = ((a1-a2) % (math.pi*2)) / (math.pi*2)
        ans[ch[i]] = ratio
    for p in P:
        print(ans[p])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

N = int(input())
points = []
for _ in range(N):
    x, y = map(int, input().split())
    points.append([x, y])
points = np.asarray(points)

ans = [0.0] * N

try:
    hull = ConvexHull(points)
except QhullError:
    ans[points.argmin(axis=0)[0]] = ans[points.argmax(axis=0)[0]] = 0.5
    print(*ans, sep='\n')
    quit()


L = hull.vertices.shape[0]

for i, v in enumerate(hull.vertices):
    prv, nxt = hull.vertices[[(i+L-1) % L, (i+1) % L]]
    deg = np.arccos(1-cosine(hull.points[prv]-hull.points[v],
                             hull.points[nxt]-hull.points[v]))
    ans[v] = (np.pi-deg)/(2*np.pi)

for val in ans:
    print("{:.20f}".format(val))

Submission status: Wrong Answer

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

N = int(input())
points = []
for _ in range(N):
    x, y = map(int, input().split())
    points.append([x, y])
points = np.asarray(points)

ans = [0.0] * N

try:
    hull = ConvexHull(points)
except QhullError:
    ans[points.argmin(axis=0)[0]] = ans[points.argmax(axis=0)[0]] = 0.5
    print(*ans, sep='\n')
    quit()


L = hull.vertices.shape[0]

for i, v in enumerate(hull.vertices):
    prv, nxt = hull.vertices[[(i+L-1) % L, (i+1) % L]]
    deg = np.arccos(1-cosine(hull.points[prv]-hull.points[v],
                             hull.points[nxt]-hull.points[v]))
    ans[v] = (np.pi-deg)/(2*np.pi)
print(*ans, sep='\n')

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
a=[list(map(int,input().split()))for i in range(n)]
b=[[-360,360]for i in range(n)]
for i in range(n):
    d=b[i]
    for j in range(n):
        if i!=j:
            if a[j][1]-a[i][1]==0:
                s=90
            else:
                s=math.degrees(math.atan((a[i][0]-a[j][0])/(a[j][1]-a[i][1])))
            if a[j][1]-a[i][1]<0:
                d[0]=max(d[0],s)
                d[1]=min(d[1],180+s)
            else:
                if s>0:
                    d[0]=max(d[0],-180+s)
                    d[1]=min(d[1],s)
                else:
                    d[0]=max(d[0],180+s)
                    d[1]=min(d[1],360+s)
for i in range(n):
    if b[i][0]<b[i][1]:
        if b[i][0]<0 and b[i][0]+360<b[i][1]:
            print((b[i][1]-b[i][0]-360)/360)
        else:
            k=(b[i][1]-b[i][0])/360
            print(k)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
a=[list(map(int,input().split()))for i in range(n)]
b=[[-360,360]for i in range(n)]
for i in range(n):
    d=b[i]
    for j in range(n):
        if i!=j:
            if a[j][1]-a[i][1]==0:
                s=90
            else:
                s=math.degrees(math.atan((a[i][0]-a[j][0])/(a[j][1]-a[i][1])))
            if a[j][1]-a[i][1]<0:
                d[0]=max(d[0],s)
                d[1]=min(d[1],180+s)
            else:
                if s>0:
                    d[0]=max(d[0],-180+s)
                    d[1]=min(d[1],s)
                else:
                    d[0]=max(d[0],180+s)
                    d[1]=min(d[1],360+s)
for i in range(n):
    if b[i][0]<b[i][1]:
        if b[i][0]<0 and b[i][0]+360<b[i][1]:
            print(0)
        else:
            k=(b[i][1]-b[i][0])/360
            print(k)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
N = input()
print(int(N[0])-1+9*(len(N)-1))

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
from math import atan2,pi
from operator import itemgetter

def InnerProduct(V0,V1):
    x0,y0=V0
    x1,y1=V1
    return x0*x1+y0*y1
def CrossProduct(V0,V1):
    x0,y0=V0
    x1,y1=V1
    return x0*y1-x1*y0
def angle(P0,P1):
    x0,y0=P0
    x1,y1=P1
    return atan2(y1-y0,x1-x0)
def counterclockwise(P0,P1,P2):
    V0,V1=(P1[0]-P0[0],P1[1]-P0[1]),(P2[0]-P0[0],P2[1]-P0[1])
    return CrossProduct(V0,V1)>0

def GrahamScan(P):
    V=sorted(P,key=itemgetter(1))
    V0=V[0]
    V=V[:1]+sorted(V[1:], key=lambda p: angle(p,V0))
    convex=[]
    for p in V:
        while len(convex)>1 and (not counterclockwise(convex[-2],convex[-1],p)):
            convex.pop()
        convex.append(p)
    return convex

n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]
d={p: i for i,p in enumerate(P)}
ans=[0]*n
CH=GrahamScan(P)
CH+=[CH[0],CH[1]]
for (x0,y0),(x1,y1),(x2,y2) in zip(CH,CH[1:],CH[2:]):
    V0,V1=(x0-x1,y0-y1),(x2-x1,y2-y1)
    ans[d[(x1,y1)]]=(pi+atan2(CrossProduct(V0,V1),InnerProduct(V0,V1)))/(2*pi)
for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
c = [[0]*2 for i in range(n) ]
a = [0] * n
p = math.pi
for i in range(n):
    c[i][0], c[i][1] = map(float, input().split())

def f(ax, ay, bx, by, cx, cy):
    vx = ax - cx
    vy = ay - cy
    wx = bx - cx
    wy = by - cy
    s = 1
    if vx * wy - vy * wx < 0: s = -1
    p = vx * wx + vy * wy
    q = ( vx * vx + vy * vy ) ** 0.5
    r = ( wx * wx + wy * wy ) ** 0.5
    t = p / (q * r)
    if t >= -1 and t <= 1: t = (math.acos( p / (q * r) )) * s
    return t

for i in range(n):
    k = (i+1)%n
    tax = 0
    tin = 0
    for j in range(n):
        if j != i and j != k:
            t = f(c[k][0], c[k][1], c[j][0], c[j][1], c[i][0], c[i][1])
            tax = max(tax, t)
            tin = min(tin, t)
    if tax - tin < p:
        a[i] = (p - tax + tin) / (p * 2)

for i in range(n):
    print(round(a[i], 6))

Submission status: Wrong Answer

Solution code:
import math
pi = math.atan(1)*4

def andrange(a, b):
    if a == (0, 0) or b == (0, 0): return (0, 0)
    if a == (0, 1): return b
    if b == (0, 1): return a
    if a[0] > b[0]: a, b = b, a
    if b[1] < a[1]:
        return (b)
    if b[0] < a[1] and b[1] >= a[1]:
        return (b[0], a[1])
    if b[0] >= a[1] and b[1] < a[0] + 1:
        return (0, 0)
    if b[1] >= a[0] + 1:
        return (a[0], b[1] - 1)

def calcrange(P, Q):
    c = calc(P, Q)
    if c > 0:
        return (c, c+0.5)
    else:
        return (c+1, c+1.5)

def calc(P, Q):
    x = P[0] - Q[0]
    y = P[1] - Q[1]
    if x == 0:
        return 0.25 if y > 0 else -0.25
    t = math.atan(y/x)
    return t/(2*pi) if x > 0 else (t/(2*pi) % 1) - 0.5

if True:
    N = int(input())
    X = []
    for _ in range(N):
        x, y = map(int, input().split())
        X.append((x, y))
else:
    X = [[0, 0], [2, 8], [4, 5], [2, 6], [3, 10]]
    N = len(X)

A = [(0, 1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        if i != j:
            A[i] = andrange(A[i], calcrange(X[i], X[j]))

for a in A:
    print("{:.20f}".format(a[1] - a[0]))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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(1000):
  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.001
for re in res:
  print(re)

Submission status: Wrong Answer

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(10000):
  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.0001
for re in res:
  print(re)

Submission status: Wrong Answer

Solution code:
from math import pi,atan2
def deg(a,b):
    d = b-a
    t = atan2(d.real, d.imag)
    if t<0: t += pi*2
    return t
n = int(input())
cs = []
for _ in range(n):
    a,b = map(int,input().split())
    cs += [complex(a,b)]
for i in range(n):
    args = [deg(cs[i],cs[j])/pi for j in range(n) if j!=i]
    print(max((1 - max(args) + min(args)) / 2, 0))

Submission status: Wrong Answer

Solution code:
import math
import sys
def cross(a, b):
	return a[0]*b[1]-a[1]*b[0]
def dot(a, b):
	return a[0]*b[0]+a[1]*b[1]
def counterclockwise(a, b):
	return cross(a, b)<0
def sub(a, b):
	return [a[0]-b[0], a[1]-b[1]]
n=input()
p=[map(int, raw_input().split()) for i in range(n)]
index={tuple(p[i]): i for i in range(n)}
p.sort()
hull=[p[0]]
min_size=1
for i in range(1, n):
	while len(hull)>min_size and not counterclockwise(sub(p[i], hull[-1]), sub(hull[-1], hull[-2])):
		del hull[-1]
	hull.append(p[i])
assert hull[-1]==p[-1]
min_size=len(hull)
for i in range(n-2, -1, -1):
	while len(hull)>min_size and not counterclockwise(sub(p[i], hull[-1]), sub(hull[-1], hull[-2])):
		del hull[-1]
	hull.append(p[i])
assert hull[0]==hull[-1]==p[0]
del hull[-1]
result=[0.0]*n
print>>sys.stderr, hull
for i in range(len(hull)):
	a=sub(hull[(i+1)%len(hull)], hull[i])
	b=sub(hull[i], hull[i-1])
	value=dot(a, b)/math.sqrt(dot(a, a))/math.sqrt(dot(b, b))
	if value<-1 or value>1:
		exit()
	angle=math.acos(value)
	result[index[tuple(hull[i])]]=angle
for i in range(n):
	print result[i]/math.pi/2, 
print

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [LI() for _ in range(n)]
    count = 10000
    k = math.pi * 2 / count
    l = 10**10
    s = 1 / count
    r = [0] * n
    for i in range(count):
        t = k * i
        x = int(math.sin(t) * l)
        y = int(math.cos(t) * l)

        mi = 0
        mm = inf ** 2
        for j in range(n):
            tm = pow(x-a[j][0], 2) + pow(y-a[j][1], 2)
            if mm > tm:
                mm = tm
                mi = j
        r[mi] += s

    return '\n'.join(map(str,r))


print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [LI() for _ in range(n)]
    count = 20000
    k = math.pi * 2 / count
    l = 10**10
    s = 1 / count
    r = [0] * n
    for i in range(count):
        t = k * i
        x = int(math.sin(t) * l)
        y = int(math.cos(t) * l)

        mi = 0
        mm = inf ** 2
        for j in range(n):
            tm = pow(x-a[j][0], 2) + pow(y-a[j][1], 2)
            if mm > tm:
                mm = tm
                mi = j
        r[mi] += s

    return '\n'.join(map(str,r))


print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [LI() for _ in range(n)]
    count = 100000
    k = math.pi * 2 / count
    l = 10**10
    s = 1 / count
    r = [0] * n
    for i in range(count):
        t = k * i
        x = int(math.sin(t) * l)
        y = int(math.cos(t) * l)

        mi = 0
        mm = inf ** 2
        for j in range(n):
            tm = pow(x-a[j][0], 2) + pow(y-a[j][1], 2)
            if mm > tm:
                mm = tm
                mi = j
        r[mi] += s

    return '\n'.join(map(str,r))


print(main())