n = int(input()) array = [list(map(int, input().split())) for _ in range(n)] visited = [[0 for _ in range(n)] for _ in range(n)] answer = float('INF') dx = [1, -1, 0, 0, 0] # 상,하,좌,우,중앙 dy = [0, 0, -1, 1, 0] def check(r, c): global n for i in range(5): nx = r + dx[i] ny = c + dy[i] if visited[nx][ny] or 0 > nx or nx > n - 1 or 0 > ny or ny > n - 1: return False return True def dfs(r, cost, cnt):..