問題一覧 > 通常問題

No.1434 Make Maze

レベル : / AI推定難易度 : 2300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 54
作問者 : tyawanmusi / テスター : chineristAC
お気に入りにしたユーザー ProblemId : 5717 / 自分の提出
問題文最終更新日: 2021-03-19 18:43:05
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 287 (順位表) の他の問題:

Problem Statement

There is a grid with $H$ rows and $W$ columns ( $H,W$ are odd). The cell in the $i$-th row from the top and the $j$-th column from the left is called cell $(i,j)$.

Chawanmushi-kun is at cell $(1,1)$. He will now travel to cell $(H,W)$ by repeatedly moving to a cell without an obstacle that is adjacent vertically or horizontally.

Before Chawanmushi-kun starts moving, you may place as many obstacles on cells as you like. However, the placement of obstacles must satisfy the following conditions.

  • No obstacle is placed on any cell $(i,j)$ where $i,j$ are both odd.
  • An obstacle is placed on every cell $(i,j)$ where $i,j$ are both even.
  • For any $2$ distinct cells without obstacles, there exists exactly one path along which Chawanmushi-kun can move between those $2$ cells without passing through the same cell $2$ or more times.

For example, the placement of obstacles in the following figure satisfies the conditions.

On the other hand, the placement of obstacles in the following figure does not satisfy the conditions.

Place obstacles so that the minimum number of moves Chawanmushi-kun needs to reach cell $(H,W)$ is $X$.

Constraints

  • All inputs are integers
  • $3 \le H,W \le 10^3$
  • $H,W$ are odd
  • $1 \le X \le HW$

Input

The input is given from standard input in the following format.

$H\ W\ X$

Output

If no placement satisfying the conditions exists, output -1.

Otherwise, output $H$ lines, each containing a string of length $W$ consisting of .,#. If you place an obstacle on cell $(i,j)$, the $j$-th character of the $i$-th line must be #; otherwise, it must be ..

Print a newline at the end.

Sample

Sample 1
Input
5 7 18
Output
...#...
##.#.##
...#...
.###.#.
.....#.

With this placement of obstacles, Chawanmushi-kun can reach cell $(H,W)$ by making $18$ moves.

Also, no condition is violated, so this output is correct.

Sample 2
Input
11 11 121
Output
-1

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。