AtCoder Grand Contest 056
翻译中…
Problem Statement
翻译中…
We have a grid board with $N$ rows and $N$ columns.
翻译中…
Paint every square black or white to satisfy all of the conditions below.
翻译中…
- For each row, exactly three of the squares in that row are painted black.
- For each column, exactly three of the squares in that column are painted black.
- There are exactly
$N$connected components of black squares. Here, two black squares$x$and$y$are considered connected when it is possible to start at$x$and reach$y$by repeatedly moving up, down, left, or right to a black square.
翻译中…
It can be proved that the Constraints of the problem guarantee the existence of a solution.
翻译中…
Constraints
翻译中…
$6 \leq N \leq 500$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
翻译中…
Output
翻译中…
Print your answer in the following format:
翻译中…
s_{1,1}s_{1,2}\cdots s_{1,N}
s_{2,1}s_{2,2}\cdots s_{2,N}
\vdots
s_{N,1}s_{N,2}\cdots s_{N,N}
翻译中…
Here, $s_{i,j}$ should be a character representing the color of the square at the $i$-th row from the top and $j$-th column from the left: $s_{i,j}=$# means the square is painted black, and $s_{i,j}=$. means it is painted white. If multiple solutions exist, printing any of them is accepted.
翻译中…
样例
Input #1
6
Output #1
##..#.
##..#.
..##.#
..##.#
##...#
..###.
Here, there are exactly $3$ `#`s in each row and column. Additionally, there are exactly $6$ connected components of `#`s.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。