luogu#P7956. [COCI 2014/2015 #6] METEOR
[COCI 2014/2015 #6] METEOR
Problem Description
You need to restore a photo after a meteor has fallen.
The photo before the meteor falls can be seen as an character matrix. represents part of the meteor, represents the ground, and the other parts are air, denoted by . All cells are connected.
Note that the meteor is strictly above the ground. That is, there exists a row of such that all are above it and all are below it. The last row of the photo is guaranteed to be all .
Please output the photo after the meteor lands. After landing, neither the meteor nor the ground changes its properties.
Input Format
The first line contains two integers .
The next lines each contain a string of length , describing the photo before the meteor falls.
Output Format
Output an matrix, representing the restored photo after the meteor falls.
5 6
.XXXX.
...X..
......
#..###
######
......
.XXXX.
...X..
#..###
######
9 7
XXX.XXX
X.XXX.X
X..X..X
X.....X
.......
.#...#.
.##.##.
.#####.
#######
.......
.......
.......
.......
XXX.XXX
X#XXX#X
X##X##X
X#####X
#######
Hint
Constraints
For of the testdata, , and each character in the matrix is one of .
Notes
According to the original problem settings, the full score is 100 points.
Translated from COCI 2014-2015 Contest #6 Task C METEOR.
Translated by ChatGPT 5