[Solution] Mainak and the Bleeding Polygon Codeforces Solution
Mainak has a convex polygon with vertices labelled as in a counter-clockwise fashion. The coordinates of the -th point are given by , where and are both integers.
Further, it is known that the interior angle at is either a right angle or a proper obtuse angle. Formally it is known that:
- , where we conventionally consider and .
Mainak's friend insisted that all points such that there exists a chord of the polygon passing through with length not exceeding , must be coloured .
Mainak wants you to find the area of the coloured region formed by the points.
Formally, determine the area of the region | .
Recall that a chord of a polygon is a line segment between two points lying on the boundary (i.e. vertices or points on edges) of the polygon.
The first line contains an integer () — the number of vertices of a polygon .
The -th line of the next lines contain two integers and () — the coordinates of .
Additional constraint on the input: The vertices form a convex polygon and are listed in counter-clockwise order. It is also guaranteed that all interior angles are in the range .
Print the area of the region coloured in .
Your answer is considered correct if its absolute or relative error does not exceed .
Formally, let your answer be , and the jury's answer be . Your answer is accepted if and only if .
No comments:
Post a Comment