Hi-performance cycling show
View as PDFBefore the cycling race, there is an artistic preshow that takes place on the circular track that is a spectacle for the eyes.
The preshow has seconds labelled by
. In each second a new cyclist joins the show at an initial position on the track at
. The cyclist will then cycle around the track until the end of the show. Each cyclist cycles in a circle around
, either clockwise or anti-clockwise. Each cyclist has differing speeds, each taking
seconds to complete a full revolution. The cyclists are experts at avoiding each other, so there is no need to worry about them colliding with each other, even if their positions are the same. In fact, whenever a new cyclist joins in, their starting position will not be occupied by previous cyclists.

The above image shows the paths of the first 3 cyclists in the first sample input. The first cyclist joins at at
and takes 3 seconds to make a full anticlockwise rotation. That means, at
, they are at the position
, and have rotated 120 degrees anticlockwise relative to the origin. In comparison, the third cyclist joins at
and takes 6 seconds to make a clockwise rotation. At
, they are at
and have rotated 60 degrees clockwise relative to the origin.
For the sake of vfx (which stands for visual effects), immediately after the th cyclist has joined, a new convex polygon is projected onto the track. This convex polygon must contain every cyclist on its interior or edge. After each cyclist has joined, what is the smallest area of the convex polygon which can be projected?

The above image shows the positions of the cyclists at in the first sample input. The smallest convex polygon such that all cyclists are on the interior is also shown.
Input
The first line has 1 integer, (
), the number of seconds in the show, and the number of cyclists that join.
lines follow, each describing the cyclist that joins at the
th second.
Each line has 4 integers,
(
) is the initial position of the cyclist
is either 0 or 1. If
is 0 then they are cycling counter-clockwise, otherwise, they are cycling clockwise.
(
) is the amount of seconds taken for the cyclist to make a full revolution.
Output
Output lines, the
th of which has the smallest area of the polygon that can be projected after the
th cyclist has joined.
Answers with a relative or absolute error of will be accepted.
Example 1
Input
5
1 0 0 3
1 1 0 4
0 2 1 6
-1 1 1 3
1 2 0 5
Output
0
0
1.18301270189253
3.36602540378446
3.34807621135265
Explanation
For the first 2 seconds, the convex polygon can have 0 area since the active cyclists can be contained on a point and line segment.
Example 2
Input
7
1 0 0 3
1 0 0 3
1 0 0 3
1 2 0 3
-10000 1000000 0 3
1000 0 0 3
2 3 0 3
Output
0
0
1.29903810567666
2.79903810567678
1616696.64279091
254830560.031683
254830560.031683
Explanation
In this input, all the cyclists are rotating about the origin in the same direction and angular speed, so it is almost as if they remained stationary.
Example 3
Input
8
10 12 1 5
0 5 1 6
9 9 0 1
10 10 0 1
-8 -3 1 2
5 -20 1 4
9 -30 0 6
1 20 0 6
Output
0
0
24.7874528984276
117.939288182412
218.065225495698
198.032032302769
690.458143401055
659.01583729355
Comments