eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Radiation

Radiation

Nuclear power plants (NPP) are a blessing and curse of modern civilization. NPPs have some risks but still it is one of the cheapest ways to produce electricity in the developed world. In this problem we will discuss a situation related to two nuclear plants, which are not far away from each other. \includegraphics{https://static.e-olymp.com/content/36/36beb909d11d5e67a15ab6aa357cea83ea573002.jpg} \textit{\textbf{Figure 1}}: Two Nuclear Power Plants. Houses at (81, 49) and (77,33) are at high risk from both the plants. We will describe the entire scenario in a flat land, so two-dimensional Cartesian coordinate system is used to denote each location. Lets assume that the coordinate of the two nuclear power plants are (\textbf{a_x}, \textbf{a_y}) and (\textbf{b_x}, \textbf{b_y}). Houses that are located within distance \textbf{R_1} (inclusive) of the power plant at (\textbf{a_x}, \textbf{a_y}) are under high risk of radiation. Similarly, houses that are located within distance \textbf{R_2} (inclusive) of the power plant at (\textbf{b_x}, \textbf{b_y}) are under high risk of radiation. So the authorities of power plant \textbf{1} and power plant \textbf{2} distribute special protective equipments to the houses that are within radius (inclusive) \textbf{R_1} and \textbf{R_2} of the respective power plants. As a result each of the houses that are endangered by both the plants actually receive two sets of equipments to protect their house, however only one set is enough for full protection. Houses that are outside the high-risk area are under low risk of radiation but they do not receive any protective equipment due to budget constraints. However, each owner of the houses that have two sets of protective equipments gives away one set of equipment to the owner of a house that has none. Still, some houses in the low-risk area remain un-protected. Given the location of the houses and the values of \textbf{a_x}, \textbf{a_y}, \textbf{b_x}, \textbf{b_y} and possible values of \textbf{R_1} and \textbf{R_2} your job is to find out the number of houses that are without protective equipments for each pair of values of \textbf{R_1} and \textbf{R_2}. \InputFile The input file contains at most \textbf{3} test cases. The description of each test case is given below: A test case starts with a line containing a positive integer \textbf{N} (\textbf{0} < \textbf{N} ≤ \textbf{200000}) that denotes the number of houses that are under either low risk or high risk of radiation. Each of the next \textbf{N} lines contains two integers \textbf{x_i}, \textbf{y_i} (\textbf{0} ≤ \textbf{x_i}, \textbf{y_i} ≤ \textbf{20000}) that denotes the coordinate of the \textbf{i}-th house. No two houses are at the same location. The next line contains five integers \textbf{a_x}, \textbf{a_y}, \textbf{b_x}, \textbf{b_y} and \textbf{q} (\textbf{0} ≤ \textbf{a_x}, \textbf{a_y}, \textbf{b_x}, \textbf{b_y} ≤ \textbf{20000}, \textbf{0} < \textbf{q} ≤ \textbf{20000}). The meaning of \textbf{a_x}, \textbf{a_y}, \textbf{b_x} and \textbf{b_y} are given in the problem statement. Here \textbf{q} denotes the total number of query. Each of the next \textbf{q} lines contains two integers, which denote the values of \textbf{R_1} and \textbf{R_2} (\textbf{0} < \textbf{R_1}, \textbf{R_2} ≤ \textbf{13000}) respectively. A line containing a single zero terminates input. This line should not be processed. \OutputFile For each test case produce \textbf{q+1} lines of output. The first line is the serial of output. For each query (given value of \textbf{R_1} and \textbf{R_2}) determine how many houses in the low risk region remains without protective equipment. You may consider using faster IO as judge input file is large. \textit{\textbf{Note}}: First query in the sample input corresponds to \textit{\textbf{Figure 1}}.
Ліміт часу 2 секунди
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
11
95 75
27 6
93 5
124 13
34 49
65 61
81 49
77 33
110 50
91 22
110 25
57 42 97 36 2
31 25
25 25
0
Вихідні дані #1
Case 1:
2
2
Джерело ACM-ICPC Asia Hatyai Regional Programming Contest – November 16, 2012 – PSU, Hatyai