#P376. 【例65.2】 清除地雷
【例65.2】 清除地雷
Description
On an map, there are some mines represented by , while other areas without mines are represented by . If a mine is detonated, its blast range will destroy the land in the surrounding eight positions and the land where the mine is located. If there are mines in its eight surrounding positions, these mines will trigger a chain reaction and continue to detonate. The land after the explosion is represented by . Please write a program to output the appearance of the map after detonating a specific mine.
Input Format
The input consists of lines:
The first line contains two integers: (), (), indicating the size of the map is .
Lines to each contain characters, representing the appearance of the map.
Line contains two integers: (), (), indicating the coordinates of the specified starting (detonation) point on the map. If the specified coordinates are land, there is no need to detonate any mines.
Output Format
Output lines, each containing numbers, representing the appearance of the map after the explosion.
Sample
5 5
10100
01000
00000
00000
00001
1 122220
22220
22200
00000
00001