Effective Area Of The Spell
Input file:
Output file:
Time limit:
Memory limit:
standard input
standard output
1 second
1024 megabytes
In the recent patch of the TOAD2 game, the effective area of the Timesphere spell of the hero Voidless is
changed once again. Now it is the semicircle!
As shown in Figure (a), the semicircle is a figure that halved the circle of radius R and center (X, Y )
such that only the points with y ≥ Y are included, and then rotated around (X, Y ) by T degrees
counterclockwise.
The heroes are represented as the line segments. The hero is affected by spell, if the intersection of the
semicircle and the line segment, representing hero, have non-zero length. The hero is killed, if the segment
is fully covered by the semicircle.
You are given several heroes. For each hero check if the hero is affected by spell. If the hero is killed,
handle it as the special case.
For example, Figure (b) shows four heroes (contiguous lines) affected by spell and three heroes (dashed
lines) that are not affected.
Input
The first line of the input contains five integers: number of heroes n (1 ≤ n ≤ 105 ), the coordinates of the
center of the semicircle X and Y (−1000 ≤ X, Y ≤ 1000), the radius of the circle R (1 ≤ R ≤ 1000) and
the rotation angle T , measured in degrees (−180 < T ≤ 180).
Each of the following n lines contains two pairs of integers Ax , Ay , Bx , By
(−1000 ≤ Ax , Ay , Bx , By ≤ 1000), representing the coordinates of the endpoints of line segments
representing the heroes.
You may assume that the length of each segment is strictly greater than 1, that the segments do not
intersect the arc forming the semicircle, that the segment may intersect the diameter, forming the
semicircle, in no more than one point, and that if we move each segment by 0.001 in any direction,
the answer will not change.
Output
Page 1 of 2
For each hero:
• Print “Yes”, if the hero is affected by spell.
• Print “No” if the hero is not affected by spell.
• Print “Yess” if the hero is killed by spell.
Example
standard input
2 1 1 5 0
1 0 1 3
2 -1 3 0
standard output
Yes
No
Page 2 of 2