|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
By the distance from a given straight line to a polygon we mean the smallest distance of any point of the polygon from this straight line (by the polygon we understand both its edges and its interior). The polygon does not need to be convex, it can also have multiple vertices and self-crossings of its boundary.
Write a program which:
In the first line of the standard input there are two integers n and m (3 ≤ n ≤ 50 000, 1 ≤ m ≤ 50 000), separated by a single space and representing the number of sides of the polygon and the number of straight lines to be analyzed. Each of the following n lines contains two integers xi and yi (-109 ≤ xi, yi ≤ 109), separated by a single space and representing coordinates of the i'th vertex of the polygon. Pairs of consecutive vertices, as well as the first and the last vertex, define sides of the polygon. Each of the following m lines contains three integers Ai, Bi and Ci (-109 ≤ Ai, Bi, Ci ≤ 109, Ai2 + Bi2 > 0), separated by single spaces and representing a straight line defined by equation Aix + Biy + Ci = 0.
Your program should print m lines to the standard output. i'th line should contain the square of the distance between i-th straight line and the polygon, written as an irreducible fraction, where numerator is separated from denominator by the / sign.
8 2 2 1 6 1 6 2 3 2 3 5 5 5 5 7 2 7 1 1 -2 1 0 -6