問題一覧 > 通常問題

No.3725 Exploit Wall

レベル : / AI推定難易度 : 2000 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 75
作問者 : 👑 kencho / テスター : 👑 p-adic uruzunyaa
お気に入りにしたユーザー ProblemId : 13568 / 自分の提出
問題文最終更新日: 2026-11-02 04:26:28
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
グリッド構築24題 (順位表) の他の問題:

Problem Statement

Alice and Bob play a game on an $N \times N$ grid. The cell in row $i$ and column $j$ of the grid is denoted by $(i, j)$.

The game proceeds as follows.

  • Step $1$. Alice paints each cell of the grid either white or black.
    • However, $(1, 1)$ and $(N, N)$ must be painted white.
    • At this point, it must not be possible to travel between $(1, 1)$ and $(N, N)$ through white cells.
  • Step $2$. Bob chooses exactly one of the following $2$ actions and performs it.
    • Choose a pair $(i, j)$ satisfying $2 \leq i \leq j \leq N-1$, and invert the colors (white to black, black to white) of all cells contained in the $j-i+1$ rows from the $i$-th row to the $j$-th row from the top.
    • Choose a pair $(i, j)$ satisfying $2 \leq i \leq j \leq N-1$, and invert the colors (white to black, black to white) of all cells contained in the $j-i+1$ columns from the $i$-th column to the $j$-th column from the left.
  • Step $3$. If it is possible to travel between $(1, 1)$ and $(N, N)$ through white cells, Alice wins. Otherwise, Bob wins.

Does there exist a way of painting the grid in Step $1$ such that Alice wins the game no matter how Bob acts? If one exists, output one example of such a painting. If none exists, output -1.

Here, "it is possible to travel between $(1, 1)$ and $(N, N)$ through white cells" means that cell $(N, N)$ can be reached from cell $(1, 1)$ by repeatedly moving to a white cell adjacent vertically or horizontally.

Constraints

  • All input values are integers.
  • $3 \leq N \leq 100$

Input

The input is given from Standard Input in the following format.

$N$

Output

If a painting satisfying the conditions exists, output one example of it in the following format. Here, $S_i\ (1 \leq i \leq N)$ is a string of length $N$, and the $j$-th character of $S_i$ must be . if the cell in the $i$-th row from the top and the $j$-th column from the left is painted white, and # if it is painted black. If no painting satisfying the conditions exists, output -1.

$S_1$
$S_2$
$\vdots$
$S_N$

Print a newline at the end.

Visualizer

A web-based visualizer for the output is available here.

During the contest, sharing visualization results and mentioning solutions or insights are prohibited. Please be careful.

In principle, questions about the specifications of the visualizer will not be accepted. Please use it only as an auxiliary tool.

Sample

Sample 1
Input
3
Output
.#.
###
.#.

The operations Bob can perform are either inverting the color of each cell in row $2$ or inverting the color of each cell in column $2$. Whichever he performs, it becomes possible to travel between $(1, 1)$ and $(N, N)$ through white cells.

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