시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB45362496.000%

문제

The big café chain Espresso Bucks is expanding to the country of Gridland. Since you are an expert on Gridland culture and geography, Espresso Bucks have hired you to decide where to put their coffee shops for maximum profit. Gridland consists of an n by m grid, where some cells are land, and some are water. At most one coffee shop can be built on each land cell. Nothing can be built on the water cells, but on the other hand, no one lives in the water. After a lot of long meetings with the Espresso Bucks people, you have come to the conclusion that there are only two constraints the placement of coffee shops has to satisfy:

  1. Each land cell must have a coffee shop directly on it, or adjacent to it.
  2. No two coffee shops can be adjacent to each other.

Two cells are adjacent if one is immediately to the west, north, east, or south of the other. Find any placement of coffee shops that satisfies these constraints.

입력

The first line of input consists of two integers n and m (1 ≤ n, m ≤ 100). The following n lines each contain a string of length m consisting only of the characters ‘.’ (land) and ‘#’ (water). This is the map of gridland. It is guaranteed that the map contains at least one land cell.

출력

Output a copy of the map of gridland, where some of the land cells have been replaced with the letter ‘E’, meaning that a coffee shop was placed on the corresponding land cell. This placement should satisfy the constraints above. If there are many solutions, any one will be accepted.

예제 입력 1

5 6
....#.
....#.
#.....
......
##...#

예제 출력 1

E..E#.
..E.#E
#..E..
.E...E
##E.E#

예제 입력 2

10 16
########.#....##
######......####
#####.....######
###.......######
##.......#######
##.........#####
##......########
##....##########
###.############
##...###########

예제 출력 2

########E#.E.E##
######E...E.####
#####E.E.E######
###E..E.E.######
##E..E.E.#######
##.E..E..E.#####
##E..E.E########
##.E..##########
###.############
##E.E###########

출처

Contest > KTH Challenge > KTH Challenge 2019 B번

  • 문제를 만든 사람: Nils Gustafsson