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

5028번 - Polyomino Powers 스페셜 저지다국어

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

문제

A polyomino is a polyform with the square as its base form. It is a connected shape formed as the union of one or more identical squares in distinct locations on the plane, taken from the regular square tiling, such that every square can be connected to every other square through a sequence of shared edges (i.e., shapes connected only through shared corners of squares are not permitted). The most well-known polyominos are the seven tetrominos made out of four squares (see figure), famous from the TetrisR game, and of course the single domino consisting of two squares from the game with the same name. Some polyomino can be obtained by gluing several copies of the same smaller polyomino translated (but not rotated or mirrored) to different locations in the plane. We call those polyomino powers.

입력

One line with two positive integers h, w ≤ 10.

Next follows an h × w matrix of characters ’.’ or ’X’, the ’X”s describing a polyomino and ’.’ space.

출력

A k-power with 2 ≤ k ≤ 5 copies of a smaller polyomino:

Output a h × w matrix on the same format as the input with the ’X”s replaced by the numbers 1 through k in any order identifying the factor pieces.

Furthermore, if multiple solutions exist, any will do. Otherwise, output ’No solution’ if no solution exists.

제한

예제 입력 1

4 9
.X..X.X.X
.XX.X.X.X
XXXXXXXXX
.XX......

예제 출력 1

.1..2.3.4
.15.2.3.4
115223344
.55......

예제 입력 2

3 7
.XXXXX.
.XX..X.
XXXX...

예제 출력 2

No solution

예제 입력 3

1 3
XXX

예제 출력 3

123

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2010 H번

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

출처

대학교 대회

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

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