TLE '16 Contest 3 P2 - In Remembrance
View as PDF
Once a year, all creatures in the Lylot System, big and small, take some time off in order to remember the great sacrifices that soldiers have made in order to keep the Lylot System safe from evils such as the Space Pirates and the Dankey Kang Gang. In the Lylot System, this day is called "Remembrance Day."
Today, Fax is in charge of firing a large space cannon as part of the Remembrance Day ceremony. However, he needs to make sure that no planets are in danger. In particular, there are  planets that he needs to be aware of; the 
 planet is located at 
. No two planets will be located at the same point or at 
. The space cannon is located at 
 and does not count as a planet.
The cannon projectile's path can be modeled using an  degree polynomial 
. Additionally, when the cannon projectile's 
 coordinate reaches a certain value 
, the projectile explodes and ceases to exist. The explosion is in the shape of a circle with a radius of 
.
Fax needs to ensure that no planet is on the path of the cannon projectile and that no planet is caught in the final explosion area, even at the edge. Can you help Fax to determine how many planets are in danger?
Input Specification
The first line of input will contain four space-separated integers,  
, 
 
, 
 
, and 
 
.
 lines of input follow. The 
 line will contain two space-separated integers 
 
 and 
 
, the coordinates of the 
 planet.
 lines of input follow. The 
 line will contain a single integer, 
 
. It is guaranteed that in the interval 
 (that is, from 
 to 
, inclusive), the absolute value of 
 will not exceed 
.
Output Specification
On a single line, output the number of planets in the path of the cannon projectile or in the explosion area.
Sample Input
6 3 5 2
1 1
2 0
3 3
5 2
6 1
4 -5
1
-7
10
Sample Output
3
Explanation for Sample Output
In the diagram, the blue curve represents the cannon projectile's path, the red circle represents the explosion area, and the black points represent the locations of planets. The planets located at , 
, and 
 are in danger.
Comments