시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
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+R29raWdlbiBOYW5hbWVcdWIyOTQgXHVjNzdjXHViY2Y4IFx1ZDM3Y1x1Yzk5MCBcdWFjOGNcdWM3ODRcdWM3NzRcdWIyZTQuIFx1YWM4Y1x1Yzc4NFx1ZDMxMFx1Yzc0MCBcdWM4MTVcdWMwYWNcdWFjMDFcdWQ2MTUgXHVhY2E5XHVjNzkwXHVjNzc0XHVhY2UwLCBcdWMyMmJcdWM3OTBcdWFjMDAgXHVjMzY4IFx1Yzc4OFx1YjI5NCBcdWIzZDlcdWFkZjhcdWI3N2NcdWJiZjhcdWFjMDAgXHVjNzdjXHViZDgwIFx1YWQ1MFx1Y2MyOFx1YzgxMFx1Y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