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

1351. Good Gnusmas – Dead Gnusmas

Time limit: 1.0 second
Memory limit: 64 MB
A dwarf bibr — a rare animal from the planet Globland. Aborigines of Globland, loathsome gnusmases, like the bibrs’ meat. Thet believe that a has eaten the bibr gnusmas becomes a globalizer (i.e. a semi-god, semi-gnusmas that is not afraid of neither acid rains nor radio-active winds of Globland.) Bibrs are very peaceful animals but defending themselves from gnusmases they use all their arsenal of weapons: pistols, submachine guns, projectors and some kinds of the weapons of close fight: fungos, knuckle-dusters and so on.
One nice morning bibr Bob woke up from the howl of anti-gnusmas siren. There were thousands of points on the radar. It meant that loathsome gnusmases scrambled out from their burrows and slowly approached Bob’s little house. But Bob was a flash guy and just a week before he had set a new Kakashnikov machine gun on his house’s roof. One burst of fire annihilates all the gnusmases that were in the arc of fire and those who survived ran away. He decided to state the value of effectiveness of his bargain and to find out how many gnusmases he would annihilate and how many of them would hide back in their burrows.


The first line contains the machine gun characteristics: D — the range (1 ≤ D ≤ 30000), X1, Y1, X2, Y2 (1 ≤ |X1| , |Y1|, |X2|, |Y2| ≤ 30000) — coordinates of the right and the left bounds of the arc of fire. The second line contains an integer N (1 ≤ N ≤ 30000) — an amount of gnusmases that attack Bob’s house. The next N lines consist of the gnusmases coordinates Xi, Yi (0 ≤ |Xi|, |Yi| ≤ 30000; Xi and Yi are not equal to zero at the same time). All the numbers are integer. Bob’s house coordinates are (0,0). The arc of fire is less than 180 degrees.


N lines with the answers “YES” and “NO”. “YES” — if the gnusmas will be annihilated (i.e. he is inside the arc of fire at the distance from Bob’s house not greater than the range of the machine gun). “NO” — otherwise.


5 1 0 0 1
1 1
5 6
3 0
-1 2
0 5
-3 0
Problem Author: Denis Musin
Problem Source: USU Junior Championship March'2005