[백준]230403-09 문제풀이(Python)
9328. 열쇠 from collections import deque import sys input = sys.stdin.readline dy = [-1, 1, 0, 0] dx = [0, 0, -1, 1] def bfs(y, x): global ans q = deque() q.append((y, x)) visited = [[False] * (w + 2) for _ in range(h + 2)] visited[y][x] = True while q: cnt = 0 now = q.popleft() for d in range(4): ny, nx = now[0] + dy[d], now[1] + dx[d] if ny h + 1 or nx w + 1: continue if ..
2023. 4. 9.