#P11254. [GDKOI2023 普及组] Macaron
[GDKOI2023 普及组] Macaron
Problem Description
You are given an two-dimensional plane as Nana’s home. The top-left corner of the wall is , and the bottom-right corner of the wall is .
There are pieces of furniture in the home. Each piece of furniture occupies exactly one lattice point, and the problem will give the coordinate of each piece of furniture.
Macaron is a cleaning robot. It is a circle with radius , and it can move in four directions: up, down, left, and right. Before and after each move, its center must stay on lattice points. It cannot pass through furniture or the outer walls while cleaning, meaning its body cannot overlap with any furniture or wall (tangency is allowed). Its initial center position is . Starting from there, it will clean the area it can reach.
Macaron wants to know how large an area it can clean. You only need to tell Macaron the number of lattice points in the plane that its center can reach after it starts.
Also, you only need to tell the answer to Macaron. There is no need to tell Nana, because Macaron does not want sad Nana to be bothered by these trivial matters.
Input Format
The first line contains two integers , representing the size of Nana’s home.
The second line contains one integer , representing the square of Macaron’s radius.
The third line contains two integers , representing Macaron’s starting position. It is guaranteed that at its initial position, Macaron does not overlap with any furniture.
The fourth line contains one integer . In the next lines, each line contains two integers , representing the coordinate of one piece of furniture.
Output Format
Only one integer , representing the answer.
10 10
5
4 5
5
7 10
6 10
5 9
4 9
4 10
29
见/example/macaron/下的 macaron1.in
见/example/macaron/下的 macaron1.out
Hint
Constraints
For all testdata, , $1 \le r \le \min(\lfloor \frac{n}{2} \rfloor, \lfloor \frac{m}{2} \rfloor)$.
Among them, of the test points satisfy .
The remaining of the test points satisfy .
Translated by ChatGPT 5