| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 8 초 | 2048 MB | 16 | 7 | 7 | 46.667% |
The Queen of the Kingdom of Icpca resides in a castle peacefully. One day, she decided to remodel the dungeon of the castle.
The dungeon is a rectangular grid consisting of square cells. Some cells are enterable rooms, while others are duct spaces which are not enterable. All pairs of adjacent cells are separated by a wall. Some of the walls between two adjacent rooms are installed with a door to go back and forth. Any pair of rooms in the dungeon has connecting paths through these doors.
The Queen wants to remodel the dungeon so that there is only one unique path between any pair of rooms. Additionally, any pair of rooms both with only one door should be connected with a path going through an even number of doors. Due to the cost limitation, what can be done in the remodeling is only to block some (possibly zero) doors.
Your mission is to find a way to remodel the dungeon as the Queen wants.
The input consists of a single test case in the following format.
$h$ $w$
$c_{1,1}c_{1,2} \cdots c_{1,2w+1}$
$c_{2,1}c_{2,2} \cdots c_{2,2w+1}$
$\vdots$
$c_{2h+1,1}c_{2h+1,2} \cdots c_{2h+1,2w+1}$
Two integers $h$ and $w$ mean that the dungeon size is $h \times w$. They are between 1ドル$ and 400ドル,ドル inclusive.
Each of the characters $c_{i,j}$ (1ドル ≤ i ≤ 2h + 1,ドル 1ドル ≤ j ≤ 2w + 1$) is either ‘.’ or ‘#’. These characters represent the configuration of the dungeon as follows.
.’ indicates that the cell is a room, while ‘#’ indicates a duct space.#’. Otherwise, $c_{i,j}$ represents the wall between cells $((i - 1)/2, j/2)$ and $((i + 1)/2, j/2)$. Being ‘.’ indicates that the wall has a door, while ‘#’ indicates that it does not. Doors are installed only in walls between two rooms.#’. Otherwise, $c_{i,j}$ represents the wall between cells $(i/2,(j - 1)/2)$ and $(i/2,(j + 1)/2)$. Being ‘.’ indicates that the wall has a door, while ‘#’ indicates that it does not. Doors are installed only in walls between two rooms.#’, corresponding to an intersection of walls.It is guaranteed that there is at least one room in the dungeon and any pair of rooms in the dungeon has one or more connecting paths.
If it is impossible to remodel the dungeon as the Queen wants, output No. Otherwise, output Yes on the first line, followed by the configuration of the dungeon after the remodeling in the same format as the input. If there are multiple possible configurations, any one of them is acceptable.
3 3 ####### #.....# #.#.### #.#...# #.#.#.# #.....# #######
Yes ####### #.....# #.##### #.#...# #.###.# #.....# #######
3 3 ####### #.....# ###.### ###...# ###.#.# #.....# #######
Yes ####### #.....# ###.### ###...# #####.# #.....# #######
3 3 ####### #.....# #.###.# #.###.# #.###.# #.....# #######
No