#P8228. 「Wdoi-5」模块化核熔炉
「Wdoi-5」模块化核熔炉
Description
The nuclear control center can be viewed as a hexagonal array made up of several regular hexagonal modules. Each module in the array can store fusion energy (a non-negative integer). The left figure is a schematic diagram of a control center.

We label each module in the control center in the following way.

Extend three rays from the center of the array as three axes, and the angle between every two axes is . These three axes divide the plane into three parts. Each module can be described by a triple as its coordinate, meaning the place reached after starting from the origin and walking several steps in the directions as shown. To avoid multiple coordinates representing the same module, we make the following rules: the origin has coordinate ; for a module whose center lies on an axis, its coordinate is the distance walked from the origin along that axis; for all other cases, we divide the plane into three regions (the red, blue, and green regions in the second figure), and the coordinate of a module is the distances that need to be walked along the two axes on its two sides, respectively. For example, module has coordinate . It is easy to see that each coordinate corresponds to exactly one module, and each module corresponds to exactly one coordinate.
Also define that the distance between two modules is the minimum number of modules that must be passed through (including the start and end modules) to go from one module to the other. In the first figure, the distance from each module in the red part to its center is at most , the distance from each module in the green part to its center is at most , and the distance from each module in the blue part to its center is at most .
The nuclear control center can be regarded as the array consisting of all modules whose distance to the origin is at most . Now Okuu will perform the following operation times:
- : Activate the module with coordinate . This increases the fusion energy of all modules in the control center whose distance to it is at most by . It is guaranteed that is inside the control center.
Now you need to output the fusion energy value in every module after all operations are finished.
Input Format
- The first line contains two positive integers , representing the size of the control center and the number of operations.
- The next lines each contain five integers , meaning to increase the fusion energy of all modules whose distance to is at most by .
Output Format
- Output one line with several integers. In the order “from left to right, from top to bottom”, output the fusion energy value in each module. Separate every two values with a space.
The red arrows in the figure below show the order “from left to right, from top to bottom”.

4 3
0 1 1 3 4
3 0 3 3 3
1 0 0 2 2
4 4 4 0 4 4 4 4 3 4 4 4 4 7 3 0 4 4 6 9 3 3 0 4 6 6 5 3 0 0 2 2 3 0 0 0 0
Hint
Sample is provided in the attachments .
Sample is provided in the attachments . It satisfies special property (see below).
Sample is provided in the attachments . It satisfies special property (see below).
Sample is provided in the attachments .
Explanation for Sample 1
As shown in the figure (the fusion energy values of all modules without numbers marked are ):

Output each value in the order “from left to right, from top to bottom”, and you can get the answer.
Constraints and Notes
This problem has test points, and each test point is worth points. The final score is the sum of the scores of all test points.
$$\def\arraystretch{1.5} \begin{array}{|c|c|c|c|}\hline \textbf{Task} & \bm{n\le } & \bm{m\le} & \textbf{Special Properties} \cr\hline 1\sim 3 & 10 & 10 & \text{A} \cr\hline 4\sim 7 & 100 & 300 & - \cr\hline 8\sim 10 & 800 & 3\times 10^5 & \text{B} \cr\hline 11\sim 14 & 800 & 3\times 10^5 & \text{A} \cr\hline 15\sim 20 & 800 & 3\times 10^5 & - \cr\hline \end{array}$$Special Property : For the -th operation, the distance from the activated module to any module on the boundary of the control center is not less than .
Special Property : For the -th operation, the activated module is always .
For all data, it is guaranteed that , , , . Each activated module is inside the control center.
Translated by ChatGPT 5
京公网安备 11011102002149号