#P6809. [BalticOI 2010] Mines (Day2)

[BalticOI 2010] Mines (Day2)

Description

You are given an H×WH \times W matrix AA. Each number in matrix AA is equal to the number of X in matrix BB at the same position plus the number of X in the eight surrounding directions of that position.

Please construct any H×WH \times W matrix BB consisting of . and X that satisfies the requirement.

Input Format

The first line contains two integers H,WH, W, indicating the size of the matrix.

The next HH lines each contain WW integers, describing matrix AA.

Output Format

Output HH lines, each containing WW characters . or X, representing a matrix BB that satisfies the condition. This problem uses SPJ.

3 5
24531
46631
34310
.XXX.
.XX..
XX...

Hint

For 100%100\% of the testdata, it is guaranteed that 1H,W6001 \le H, W \le 600, and a solution always exists.

Translated from BalticOI 2010 Day2 T3 Mines.

Translated by ChatGPT 5