Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B"Mainak has a convex polygon mathcal P with n vertices labelled as A_1, A_2, ldots, A_n in a counter-clockwise fashion. The coordinates of the i -th point A_i are given by (x_i, y_i) , where x_i and y_i are both integers. Further, it is known that the interior angle at A_i is either a right angle or a proper obtuse angle. Formally it is known that: Mainak's friend insisted that all points Q such that there exists a chord of the polygon mathcal P passing through Q with length not exceeding 1 , must be coloured color{red}{ text{red}} . Mainak wants you to find the area of the coloured region formed by the color{red}{ text{red}} points. Formally, determine the area of the region mathcal S = {Q in mathcal{P} | Q text{ is coloured } color{red}{ text{red}} } . 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 n ( 4 <= n <= 5000 ) -- the number of vertices of a polygon mathcal P . The i -th line of the next n lines contain two integers x_i and y_i ( -10^9 <= x_i, y_i <= 10^9 ) -- the coordinates of A_i . 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 [90^ circ ; 180^ circ ) . Print the area of the region coloured in color{red}{ text{red}} . Your answer is considered correct if its absolute or relative error does not exceed 10^{-4} . Formally, let your answer be a , and the jury's answer be b . Your answer is accepted if and only if frac{|a - b|}{ max{(1, |b|)}} <= 10^{-4} . In the first example, the polygon mathcal P can be visualised on the Cartesian Plane as: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
171158905 |
rainboy |
H |
Sept. 6, 2022, 6:16 p.m. |
OK |
GNU C11 |
TESTS |
53 |
436 |
204800 |
|
|
171171100 |
mak_id |
H |
Sept. 6, 2022, 8:36 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
31 |
102400 |
|
|
171183427 |
GoD.FaTHeR |
H |
Sept. 7, 2022, 1:35 a.m. |
OK |
GNU C++17 |
TESTS |
53 |
31 |
102400 |
|
|
171165152 |
Fazor52 |
H |
Sept. 6, 2022, 7:14 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
93 |
204800 |
|
|
171166538 |
bhavyagupta_11 |
H |
Sept. 6, 2022, 7:30 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
265 |
1331200 |
|
|
171166152 |
Benq |
H |
Sept. 6, 2022, 7:26 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
265 |
1331200 |
|
|
171189826 |
Chenyu_Qiu |
H |
Sept. 7, 2022, 3:53 a.m. |
OK |
GNU C++20 (64) |
TESTS |
53 |
15 |
102400 |
|
|
remove filters
Back to search problems