BOI - Mines
Heino drew an H × W grid. Each cell was either empty or contained a mine. Indrek, a good friend of Heino, drew another H × W grid. In each cell of his grid, he wrote the total number of mines in the corresponding cell of Heino’s grid and all its adjacent cells (two cells are adjacent if they share a common point). Indrek then erased Heino’s grid. Given Indrek’s grid, your task is to help Heino restore his original grid.
You may assume that at least one solution always exists.
The output should contain H lines. Each of these lines should contain W characters: ‘X’ for a mine and ‘.’ for an empty cell.
If there are several correct solutions, submit any one of them.
Input:
3 5
24531
46631
34310Output:
.XXX.
.XX..
XX...Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.