시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 1024 MB2718654.545%

문제

Diagonals is a pencil puzzle which is played on a square grid. The player must draw a diagonal line corner to corner in every cell in the grid, either top left to bottom right, or bottom left to top right. There are two constraints:

  • Some intersections of gridlines have a number from $0$ to $4$ inclusive on them, which is the exact number of diagonals that must touch that point.
  • No set of diagonals may form a loop of any size or shape.

The following is a $5\!\times\!5$ example, with its unique solution:

Given the numbers at the intersections of a grid, solve the puzzle.

입력

The first line of input contains an integer $n$ ($1 \le n \le 8$), which is the size of the grid.

Each of the next $n+1$ lines contains a string $s$ ($|s|=n+1, s \in \{\texttt{0},\texttt{1},\texttt{2},\texttt{3},\texttt{4},\texttt{+}\}^*$). These are the intersections of the grid, with '+' indicating that there is no number at that intersection.

The input data will be such that the puzzle has exactly one solution.

출력

Output exactly $n$ lines, each with exactly $n$ characters, representing the solution to the puzzle. Each character must be either '/' or '\'.

Note that Sample 1 corresponds to the example in the problem description.

예제 입력 1

5
+1+2++
1++11+
+3+2++
02+++1
++3+1+
+1+++1

예제 출력 1

\\/\\
\/\\/
\\\\\
////\
//\\\

예제 입력 2

3
++++
+1+1
+31+
+0+0

예제 출력 2

/\/
///
/\/

예제 입력 3

4
+++++
+3++2
++3++
+3+3+
++2+0

예제 출력 3

\//\
\\//
\\\/
/\//