시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
8 초 (추가 시간 없음) | 1024 MB | 27 | 18 | 6 | 54.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:
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.
5 +1+2++ 1++11+ +3+2++ 02+++1 ++3+1+ +1+++1
\\/\\ \/\\/ \\\\\ ////\ //\\\
3 ++++ +1+1 +31+ +0+0
/\/ /// /\/
4 +++++ +3++2 ++3++ +3+3+ ++2+0
\//\ \\// \\\/ /\//
ICPC > Regionals > North America > Pacific Northwest Regional > 2021 ICPC Pacific Northwest Region > Division 1 I번
ICPC > Regionals > North America > Pacific Northwest Regional > 2021 ICPC Pacific Northwest Region > Division 2 V번
ICPC > Regionals > North America > South Central USA Regional > 2021 South Central USA Regional Contest > Division 1 C번
ICPC > Regionals > North America > South Central USA Regional > 2021 South Central USA Regional Contest > Division 2 C번
ICPC > Regionals > North America > Mid-Central Regional > Mid-Central USA Programming Contest 2021 K번
ICPC > Regionals > North America > Northeast North America Regional > 2021 Northeast North America Regional Contest G번
ICPC > Regionals > North America > Southeast USA Regional > 2021 Southeast USA Regional Programming Contest > Division 1 C번
ICPC > Regionals > North America > Southeast USA Regional > 2021 Southeast USA Regional Programming Contest > Division 2 C번