Logo
(追記) (追記ここまで)

18447번 - Angle Beats 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB79171323.636%

문제

You have a rectangular board consisting of n × m squares. Each square contains a character which is either “*”, “+”, or “.”.

A tromino is a figure formed by a square of the board, called the center, and two other squares, each sharing an edge with the center. A tromino is L-shaped if these two squares have a common vertex, and I-shaped otherwise.

You can draw some disjoint trominoes on the board. The center of an I-shaped tromino must contain “+”. The center of an L-shaped tromino must contain either “*” or “+”. All non-center squares of all trominoes must contain “.”.

Your goal is to draw the maximum number of non-intersecting polyominoes.

입력

The first line contains two integers n and m: the number of rows and columns of the board (2 ≤ n, m ≤ 100).

Each of the next n lines contains m characters, and each character is either “*”, “+”, or “.”. Together, these lines describe the board.

출력

Print n lines, each containing m characters: the board with trominoes on it. If a square belongs to some tromino, output a lowercase English letter, and if not, output the character contained in this square. Squares of the same tromino must contain the same letter. Squares which share an edge and belong to different trominoes must contain different letters.

If there are several possible answers, print any one of them.

제한

예제 입력 1

2 2
*.
..

예제 출력 1

aa
a.

예제 입력 2

3 3
...
.*.
...

예제 출력 2

.a.
aa.
...

예제 입력 3

5 5
+*..+
..++.
.+.++
.**.+
.+*.+

예제 출력 3

+*baa
.bb+a
ccc++
.**.+
.+*.+

예제 입력 4

11 13
.............
.+++....+++..
....+..+.....
....+..+.....
....+..+.....
.+++....+++..
....+......+.
....+......+.
....+......+.
.+++....+++..
.............

예제 출력 4

.abc....abc..
aabcc..aabcc.
..baaacccb...
...dddeee....
.abfffgggbc..
aab+a..aabcc.
..baa...abaaa
...ccc....ddd
.abddd..abccc
aabee..aabee.
..be.....be..

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 1: 300iq Contest A번

  • 문제를 만든 사람: 300iq
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /