
Baekjoon/DFS와 BFS
🥇[백준] 7569 토마토 (골드5) / BFS, 3차원 리스트
문제요약 나의 코드 및 설명 import sys from collections import deque def bfs(): global days while queue: x,y,z = queue.popleft() for i in range(6): nx = x + dx[i] ny = y + dy[i] nz = z + dz[i] if nx=h: continue else: #다음 좌표가 아직 익지 않은 토마토(0)이고, 방문하지 않았다면, if board[nz][ny][nx] == 0 and visited[nz][ny][nx] == 0: #토마토가 익는다. board[nz][ny][nx] = 1 #다음 좌표의 방문 테이블 값은 현재 좌표 값 + 1 visited[nz][ny][nx] = visited[z][y][..