ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Ural Championship 2004 Round 2

About     Problems     Submit solution     Judge status     Standings
Contest is over

A. Hail

Time limit: 1.0 second
Memory limit: 64 MB
A special device was mounted to defend a car parking from a hail. Large hailstones are detected by a special radar and evaporated by a powerful laser. The parking lot has the shape of a convex polygon and is surrounded by a high fence. The height of the fence is h meters. The laser is located somewhere strictly inside this polygon at the ground level. The laser can evaporate hailstones, which pass at a distance of no more than d meters from it. The fence is impenetrable for laser beams. Hailstones fall vertically downward. It is known that the location and power of the laser are such that it can destroy all hailstones falling to the territory of the parking lot before they reach the level of the upper edge of the fence. The laser destroys all hailstones it can, regardless of whether they would fall inside or outside the fence. The laser can perform all the necessary operations instantly, so it can destroy several hailstones in different places practically simultaneously. Knowing the coordinates of the places where hailstones would fall, you should determine how many of them will be destroyed by the laser.


The first line contains an integer n (3 ≤ n ≤ 10), which is the number of polygon vertices, and a real number h (1.00 ≤ h ≤ 100.00), which is the height of the fence. The following n lines contain pairs of real numbers, which are coordinates (in meters) of the polygon vertices. The vertices are given in the order of bypass. The next line contains the number d (h < d < 1000.00) and the coordinates of the laser. It is followed by a line containing the number of hailstones k (1 ≤ k ≤ 100). And the following k lines contain pairs of real numbers, which are x and y coordinates of hailstones. Absolute values of all coordinates do not exceed 1000.


You are to write a program that outputs exactly one integer, which is the number of destroyed hailstones.


4 10.00
1.00 0.00
0.00 1.00
-1.00 0.00
0.00 -1.00
50.00 0.00 0.00
0.00 0.00
1.00 1.00
2.00 2.00
3.00 3.00
4.00 4.00
Problem Author: Idea: Pavel Atnashev, prepared by Pavel Atnashev, Alexey Lakhtin
Problem Source: VIII Collegiate Students Urals Programming Contest. Yekaterinburg, March 11-16, 2004
To submit the solution for this problem go to the Problem set: 1317. Hail