브루트뽀쓰 벽좌표는 미리 담아서 검사 import sys input = sys.stdin.readline from collections import deque def move(x,y): q = deque() q.append([x,y,0]) visited[x][y] = True while q: x,y,cnt = q.popleft() if x==Fr-1 and y==Fc-1: return cnt for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0