시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 9 5 4 50.000%

문제

Gokigen Naname는 일본 퍼즐 게임이다. 게임판은 정사각형 격자이고, 숫자가 쓰여 있는 동그라미가 일부 교차점에 있다.

게임의 목표는 격자의 모든 칸에 사선을 그어 모든 동그라미와 연결된 사선의 수가 동그라미 안에 있는 숫자와 일치하게 만드는 것이다. 또, 사선을 이용해서 닫힌 루프를 만들면 안 된다.

왼쪽 그림은 게임판이고, 오른쪽 그림은 왼쪽 퍼즐을 푼 상태이다. Gokigen Naname 퍼즐이 주어졌을 때, 퍼즐을 푸는 프로그램을 작성하시오. 항상 답이 유일한 경우만 주어진다.

입력

첫째 줄에 격자 한 변에 있는 칸의 수 n이 주어진다. (2 ≤ n ≤ 7)

다음 n+1개 줄에는 격자의 교차점 정보가 주어지며, 항상 n+1개 문자로 이루어져 있다. '.'인 경우는 교차점에 숫자가 없는 경우이다. 

출력

퍼즐을 모두 푼 상태를 출력한다.

예제 입력 1

5
.21...
..33.0
......
..33..
0..33.
....11

예제 출력 1

/\\//
//\\\
\\\//
\/\\/
///\\
W3sicHJvYmxlbV9pZCI6IjUwMzciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJHb2tpZ2VuIE5hbmFtZSIsImRlc2NyaXB0aW9uIjoiPHA+R29raWdlbiBOYW5hbWVcdWIyOTQgXHVjNzdjXHViY2Y4IFx1ZDM3Y1x1Yzk5MCBcdWFjOGNcdWM3ODRcdWM3NzRcdWIyZTQuIFx1YWM4Y1x1Yzc4NFx1ZDMxMFx1Yzc0MCBcdWM4MTVcdWMwYWNcdWFjMDFcdWQ2MTUgXHVhY2E5XHVjNzkwXHVjNzc0XHVhY2UwLCBcdWMyMmJcdWM3OTBcdWFjMDAgXHVjNGYwXHVjNWVjIFx1Yzc4OFx1YjI5NCBcdWIzZDlcdWFkZjhcdWI3N2NcdWJiZjhcdWFjMDAgXHVjNzdjXHViZDgwIFx1YWQ1MFx1Y2MyO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