링크🔗https://www.acmicpc.net/problem/2589🗒️파이썬 코드 풀이from collections import deque import syssys.setrecursionlimit(10**6)input = sys.stdin.readlineN,M = map(int,input().split())graph = [list(input().strip()) for _ in range(N)]visited = [[-1] * M for _ in range(N)]ans = -1di,dj = [0,1,0,-1],[1,0,-1,0]def bfs(i,j): global ans visited = [[-1] * M for _ in range(N)] visited[i][j] = 0 q = ..