백준 | 7576번 | 토마토
1) 문제 링크: https://www.acmicpc.net/problem/7576 2) 코드 from collections import deque m, n = map(int, input().split()) matrix = [list(map(int, input().split())) for _ in range(n)] queue = deque([]) dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1] result = 0 for i in range(n): for j in range(m): if matrix[i][j] == 1: queue.append([i, j]) def bfs(): while queue: x, y = queue.popleft() for i in range(4): nx, ny ..