import numpy as np

from scipy.spatial import ConvexHull

from scipy.spatial.qhull import QhullError

from scipy.spatial.distance import cosine



def main(points):

    ans = [0.0] * N



    try:

        hull = ConvexHull(np.asarray(points))

    except QhullError:

        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5

        return ans



    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)

    return ans





if __name__ == '__main__':

    N = int(input())

    points = []

    for _ in range(N):

        x, y = map(int, input().split())

        points.append([x, y])

    print(*main(points), sep='\n')

import numpy as np

from scipy.spatial import ConvexHull

from scipy.spatial.qhull import QhullError

from numpy.linalg import norm





def main():

    N = int(input())

    points = []

    for _ in range(N):

        x, y = map(int, input().split())

        points.append([x, y])



    ans = np.zeros(N)

    try:

        hull = ConvexHull(points)

    except QhullError:

        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5

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

        return



    v = hull.vertices

    prv_v, nxt_v = np.roll(v, -1), np.roll(v, 1)

    diff_prev = hull.points[prv_v]-hull.points[v]

    diff_next = hull.points[nxt_v]-hull.points[v]

    deg = np.arccos(np.einsum("ij, ij->i", diff_prev, diff_next) /

                    norm(diff_prev, axis=1) / norm(diff_next, axis=1))

    ans[v] = (np.pi - deg) / (2 * np.pi)

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





if __name__ == '__main__':

    main()

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


def main(points):
    ans = [0.0] * N
    try:
        hull = ConvexHull(np.asarray(points))
    except QhullError:
        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5
        return ans
    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)
    return ans


if __name__ == "__main__":
    N = int(input())
    points = []
    for _ in range(N):
        x, y = map(int, input().split())
        points.append([x, y])
    print(*main(points), sep="\n")

import numpy as np
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
from numpy.linalg import norm


def main():
    N = int(input())
    points = []
    for _ in range(N):
        x, y = map(int, input().split())
        points.append([x, y])
    ans = np.zeros(N)
    try:
        hull = ConvexHull(points)
    except QhullError:
        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5
        print(*ans, sep="\n")
        return
    v = hull.vertices
    prv_v, nxt_v = np.roll(v, -1), np.roll(v, 1)
    diff_prev = hull.points[prv_v] - hull.points[v]
    diff_next = hull.points[nxt_v] - hull.points[v]
    deg = np.arccos(
        np.einsum("ij, ij->i", diff_prev, diff_next)
        / norm(diff_prev, axis=1)
        / norm(diff_next, axis=1)
    )
    ans[v] = (np.pi - deg) / (2 * np.pi)
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

-from scipy.spatial.distance import cosine +from numpy.linalg import norm -def main(points): -    ans = [0.0] * N -    try: -        hull = ConvexHull(np.asarray(points)) -    except QhullError: -        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5 -        return ans -    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) -    return ans - - -if __name__ == "__main__": +def main(): -    print(*main(points), sep="\n") +    ans = np.zeros(N) +    try: +        hull = ConvexHull(points) +    except QhullError: +        ans[points.index(min(points))] = ans[points.index(max(points))] = 0.5 +        print(*ans, sep="\n") +        return +    v = hull.vertices +    prv_v, nxt_v = np.roll(v, -1), np.roll(v, 1) +    diff_prev = hull.points[prv_v] - hull.points[v] +    diff_next = hull.points[nxt_v] - hull.points[v] +    deg = np.arccos( +        np.einsum("ij, ij->i", diff_prev, diff_next) +        / norm(diff_prev, axis=1) +        / norm(diff_next, axis=1) +    ) +    ans[v] = (np.pi - deg) / (2 * np.pi) +    print(*ans, sep="\n") + + +if __name__ == "__main__": +    main()