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

24843번 - Friendly Rooks 스페셜 저지다국어

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

문제

Rook is a piece in the game of chess. It moves horizontally or vertically through any number of unoccupied squares, and can not jump over pieces. The rook can capture other piece if the piece is on the same vertical or horizontal line with the rook. There can be no more than one rook in one square of the chess board.

You are given $k$ rooks and a chess board with of $n \times m$. You need place these rooks on the board so that they cannot capture each other.

입력

The only line of input contains three integers $n,ドル $m$ and $k$ --- the lengths of the chess board sides and the number of rooks (1ドル \le n, m, k \le 100$).

출력

If it is impossible to place $k$ rooks on an $n \times m$ chess board, print the line Impossible.

If there is at least one correct placement, print Possible. Then output $n$ lines of $m$ characters each --- the description of the placement of the rooks on the chess board. The $j$-th character of the $i$-th line must be "*" if the square $(i, j)$ contains a rook, or "." if the corresponding square in your placement is empty.

If there are several correct placements, you can output any of them.

제한

예제 입력 1

1 2 1

예제 출력 1

Possible
*.

예제 입력 2

3 3 100

예제 출력 2

Impossible

예제 입력 3

3 5 2

예제 출력 3

Possible
..*..
.....
*....

힌트

Image of the rook placement for the third test case:

Red marks the squares that the lower left rook can capture, blue marks the squares that the upper right rook can capture, purple --- squares that can be captured by both rooks.

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2021 A번

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

출처

대학교 대회

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

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