P6809 [BalticOI 2010] Mines (Day2)

Background

**This is an output-only problem. The input is public; please see the attachments of the problem.**

Description

You are given an $H \times W$ matrix $A$. Each number in matrix $A$ is equal to the number of `X` in matrix $B$ at the same position plus the number of `X` in the eight surrounding directions of that position. Please construct any $H \times W$ matrix $B$ consisting of `.` and `X` that satisfies the requirement.

Input Format

The first line contains two integers $H, W$, indicating the size of the matrix. The next $H$ lines each contain $W$ integers, describing matrix $A$.

Output Format

Output $H$ lines, each containing $W$ characters `.` or `X`, representing a matrix $B$ that satisfies the condition. **This problem uses SPJ.**

Explanation/Hint

For $100\%$ of the testdata, it is guaranteed that $1 \le H, W \le 600$, and a solution always exists. **Translated from [BalticOI 2010](https://www.luogu.com.cn/problem/U126003) [Day2](https://boi.cses.fi/files/boi2010_day2.pdf) *T3 Mines*.** Translated by ChatGPT 5