N-Ta-Gon Has a Problem

mainstring test contest
Limits 2s, 512 MB

N-ta-gon is a regular convex polygon shaped stadium where the polygon has N arms. Recently an alien spaceship has landed inside the stadium which is also a convex polygon but not necessarily a regular polygon. This alien ship has a weird behaviour. It needs to spin once a day within the minimum area possible to keep things functional.

Now that the natural purpose of the stadium is gone, the scientists want to rebuild the stadium around the spaceship for study. They actually want to scale the stadium Sth time so that it takes minimum area possible to contain the spaceship and its spinning behaviour. S can be fractional.

You are given N the arm count of N-ta-gon and L the length of each arm before the alien ship arrived. You are also given the configuration of the alien ship. Find X.


First line contains two integers N and L - the original configuration of the stadium.

Next line contains one integer M the number of vertices in the alien ship.

In the next M lines, each contains two integers Xi Yi - the ith vertex of the alien ship.


3 <= N <=109

3 <= L <=103

3 <= M <= 105

-109 <= Xi, Yi <= 109

-- the vertices of the alien ship are given anti-clockwise.


Print one number - the value of S.

The output will be considered correct if it matches atleast 8 digits after decimal point with judge output.


4 10
7 3
6 8
1 3


The given alien ship is BCD triangle. It takes minimum of AB radius of a circle to spin. So the stadium needs to be scaled to at least EFGH square to fit the spinning alien ship. And we want the stadium to be as small as possible


Login to submit.


83% Solution Ratio
NirjhorEarliest, Dec '19
steinumFastest, 0.0s
clist.byLightest, 655 kB
user.380284Shortest, 878B
Toph uses cookies. By continuing you agree to our Cookie Policy.