No.3731 Kaleidoscope
Problem Statement
Output $1$ example of an $N \times N$ grid, with each cell painted white or black, that satisfies all of the following conditions. Note that the grid size $N$ is not given in the input, and you may choose it freely.
- $2 \leq N \leq 2^{10}$
- Cells $(1, 1)$ and $(N, N)$ are painted white.
- For $1 \leq i \leq |S|$, if the $i$-th character of the string $S$ is
o, there exists a path from cell $(1,1)$ to $(N,N)$, formed by repeatedly moving to an adjacent white cell to the right or downward, that turns $i$ times along the way. - For $1 \leq i \leq |S|$, if the $i$-th character of the string $S$ is
x, there does not exist a path from cell $(1,1)$ to $(N,N)$, formed by repeatedly moving to an adjacent white cell to the right or downward, that turns $i$ times along the way.
Here, $|S|$ denotes the length of the string $S$.
A path "turns $i$ times along the way" means that, among the moves on the path (excluding the first one), exactly $i$ moves have a direction (right or down) different from that of the immediately preceding move.
It does not matter whether paths with more than $|S|$ turns exist.
If no grid satisfying the conditions exists, output -1.
Constraints
- $S$ is a string consisting of
oandx - $1 \leq |S| \leq 1000$
Input
The input is given from standard input in the following format.
$S$
Output
If a painting satisfying the conditions exists, output one example in the following format. Here, $T_i\ (1 \leq i \leq N)$ is a string of length $N$, and the $j$-th character of $T_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.
$N$ $T_1$ $T_2$ $\vdots$ $T_N$
If no painting satisfying the conditions exists, output -1.
Print a newline at the end.
Visualizer
A web-based visualizer for the output is available here.
Please note that during the contest, sharing visualization results and mentioning solutions or insights are prohibited.
In principle, questions about the visualizer's specifications will not be accepted. Please use it only as an auxiliary tool.
Sample
Sample 1
Input
oxo
Output
3 .## ..# ...
An example of a path that turns $1$ time along the way is $(1, 1) \rightarrow (2, 1) \rightarrow (3, 1) \rightarrow (3, 2) \rightarrow (3, 3)$.
There is no path that turns $2$ times along the way.
An example of a path that turns $3$ times along the way is $(1, 1) \rightarrow (2, 1) \rightarrow (2, 2) \rightarrow (3, 2) \rightarrow (3, 3)$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。