Codeforces Round 300
D
Weird Chess
Codeforces
1800
原题
← CE →
翻译中…

Igor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of the game and become world famous.

翻译中…

Igor's chessboard is a square of size $*n* × *n*$ cells. Igor decided that simple rules guarantee success, that's why his game will have only one type of pieces. Besides, all pieces in his game are of the same color. The possible moves of a piece are described by a set of shift vectors. The next passage contains a formal description of available moves.

翻译中…

Let the rows of the board be numbered from top to bottom and the columns be numbered from left to right from 1 to $*n*$. Let's assign to each square a pair of integers $(*x*, *y*)$ — the number of the corresponding column and row. Each of the possible moves of the piece is defined by a pair of integers $(*dx*, *dy*)$; using this move, the piece moves from the field $(*x*, *y*)$ to the field $(*x* + *dx*, *y* + *dy*)$. You can perform the move if the cell $(*x* + *dx*, *y* + *dy*)$ is within the boundaries of the board and doesn't contain another piece. Pieces that stand on the cells other than $(*x*, *y*)$ and $(*x* + *dx*, *y* + *dy*)$ are not important when considering the possibility of making the given move (for example, like when a knight moves in usual chess).

翻译中…

Igor offers you to find out what moves his chess piece can make. He placed several pieces on the board and for each unoccupied square he told you whether it is attacked by any present piece (i.e. whether some of the pieces on the field can move to that cell). Restore a possible set of shift vectors of the piece, or else determine that Igor has made a mistake and such situation is impossible for any set of shift vectors.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($1 ≤ *n* ≤ 50$).

翻译中…

The next $*n*$ lines contain $*n*$ characters each describing the position offered by Igor. The $*j*$-th character of the $*i*$-th string can have the following values:

翻译中…
  • o — in this case the field $(*i*, *j*)$ is occupied by a piece and the field may or may not be attacked by some other piece;
  • x — in this case field $(*i*, *j*)$ is attacked by some piece;
  • . — in this case field $(*i*, *j*)$ isn't attacked by any piece.
翻译中…

It is guaranteed that there is at least one piece on the board.

翻译中…

Output

翻译中…

If there is a valid set of moves, in the first line print a single word 'YES' (without the quotes). Next, print the description of the set of moves of a piece in the form of a $(2*n* - 1) × (2*n* - 1)$ board, the center of the board has a piece and symbols 'x' mark cells that are attacked by it, in a format similar to the input. See examples of the output for a full understanding of the format. If there are several possible answers, print any of them.

翻译中…

If a valid set of moves does not exist, print a single word 'NO'.

翻译中…

Note

翻译中…

In the first sample test the piece is a usual chess rook, and in the second sample test the piece is a usual chess knight.

翻译中…

样例

Input #1
5
oxxxx
x...x
x...x
x...x
xxxxo
Output #1
YES
....x....
....x....
....x....
....x....
xxxxoxxxx
....x....
....x....
....x....
....x....
InputCopy OutputCopy
Input #2
6
.x.x..
x.x.x.
.xo..x
x..ox.
.x.x.x
..x.x.
Output #2
YES
...........
...........
...........
....x.x....
...x...x...
.....o.....
...x...x...
....x.x....
...........
...........
...........
InputCopy OutputCopy
Input #3
3
o.x
oxx
o.x
Output #3
NO
InputCopy OutputCopy
题目信息
题号
538D
时间限制
2 s
内存限制
256 MB
标签
暴力
构造
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。