QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100

#12042. Defense Tower

الإحصائيات

Kaguya is a playful girl.

One day, she is playing a tower defense game. The game map can be viewed as a 2D plane. Kaguya has already built $n$ defense towers, where the $i$-th tower is located at point $A_i$ with coordinates $(x_i, y_i)$.

Defense towers require sufficient energy to operate, so Kaguya needs to choose a location $O$ to build an energy source. Once the energy source is built, the defense range of the $i$-th tower is defined as the circle centered at $A_i$ that passes through point $O$ (including the boundary).

Kaguya discovers that after building the energy source, some defense towers might become redundant. To save energy, she wants to remove as many defense towers as possible while keeping the total defense range (the region covered by at least one defense tower's range) unchanged.

Now, Kaguya has $m$ plans for the energy source location $O_j$ with coordinates $(a_j, b_j)$. For each plan, she wants you to calculate the maximum number of defense towers that can be removed.

For example, when the coordinates of three defense towers are $(-1, 1), (0, -1), (1, 2)$ and the energy source coordinate is $(2, 4)$, the defense range is shown in the figure below. Clearly, at most one defense tower can be removed.

Input

The first line contains two positive integers $n (n > 1)$ and $m$.

The next $n$ lines each contain two integers $x_i, y_i (|x_i|, |y_i| \leq 10^9)$, representing the coordinates of the defense towers.

The next $m$ lines each contain two integers $a_i, b_i (|a_i|, |b_i| \leq 10^9)$, representing an energy source plan.

It is guaranteed that all points (including defense tower coordinates and energy source plans) have distinct $x$-coordinates and distinct $y$-coordinates.

Output

For each energy source plan, output one integer per line representing the maximum number of defense towers that can be removed while keeping the defense range unchanged.

Examples

Input 1

4 2
0 -1
-1 1
1 2
2 4
-3 3
3 -2

Output 1

2
1

Subtasks

This problem is divided into 4 subtasks. You must pass all test cases in a subtask to receive the points for that subtask:

Subtask 1 (11 points): $n \leq 3, m \leq 100$.

Subtask 2 (36 points): $n \leq 50, m \leq 100$.

Subtask 3 (29 points): $n, m \leq 3000$.

Subtask 4 (24 points): $n, m \leq 2 \times 10^5$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.