P16205 [o.OI R-1 EX] Similar Problem
Background
*(The problem provider is True154.)*
## **Please submit using the “submit answer” method to prevent your solution from being stolen.**
On December 8, 2005, the United Nations General Assembly announced that April 4 each year would be set as the International Day for Mine Awareness and Assistance in Mine Action (full name: International Day for Mine Awareness and Assistance in Mine Action).
This day aims to raise public awareness of the humanitarian threats caused by landmines, explosive remnants of war, and improvised explosive devices, and to encourage countries to strengthen their mine action capabilities.
The ~~flea~~ frog country has always taken ~~flea~~ frog humanitarianism as its foundation, regarding the protection of civilians and the healing of war trauma as its duty. In response to the international call, the ~~flea~~ frog country has decided to form a team with both solid knowledge of landmines and rich mine-clearing experience. At present, four-by-seven selection problems closely centered on the Minesweeper theme are ready. Who will stand out in this selection? Let us wait and see.
Description
For each $0 \le k \le 27$, you need to place as few mines as possible in the cube with coordinates $x,y,z \in [0,n+1]$, such that for any $x,y,z \in [1,n]$, if $(x,y,z)$ is not a mine, then among the $26$ positions adjacent to it, there are exactly $k$ mines.
Here, two coordinates are called “adjacent” if the difference of each coordinate is at most $1$. **It is guaranteed that $\bm{n=55}$.**
In this problem, you need to directly use one program to output the constructions for $k=0$ to $k=27$ in order. See 【Output Format】 for details.
Input Format
Input an integer $n$, guaranteed $n=55$.
Output Format
Output the constructions for $k=0,\cdots,27$ in order.
For each $k$, output $(n+2)$ square matrices of size $(n+2)$ rows and $(n+2)$ columns. From top to bottom, they represent the mine layout in your construction. `*` denotes a mine, and `.` denotes empty space. Do not output extra blank lines.
Explanation/Hint
## Sample Explanation
In the sample output, all positions are mines, which is a valid output.
According to the scoring rules, $p_i$ is the number of empty cells, which is $0$.
The total score is $0$.
## Scoring Rules
Define $p_i(0 \le i \le 27)$ as:
- If your construction for $k=i$ is valid, then $p_i$ is the number of empty cells.
- If your construction for $k=i$ is invalid, then $p_i=0$.
Your score is $\sum_{i=0}^{27} p_i$.
If you do not know how to construct for some $k$, you still need to output any layout in the required format.
You need to achieve a total score of at least $2970000$ in this problem to be considered as passing.
The highest score on-site was $2938095$, and the current sum of the highest scores at all points is $2978155$.
## Checker
After downloading the additional file, there is a line inside:
```freopen("1.out","r",stdin);```
`1.out` is your answer output file, and the checker will read from this file.
If the output format is incorrect, it returns `Wrong answer.`
Otherwise, you will get the total score, as well as the validity and score for $k=0,\cdots,27$.
Translated by ChatGPT 5