불!1 [백준]BOJ 4179: 불! - Python/BFS https://www.acmicpc.net/problem/4179 문제풀이지훈이가 움직이고, 불을 퍼뜨리면 된다. 순서대로 진행하면 되는데 주의해야 할 점이 두 가지 있다.1. 1분마다 기준으로 번갈아서 움직여야 한다.2. 지훈이가 움직이기 전에 불에 타면 안된다.코드from collections import dequedef bfs(jihun, fires): is_jihun_Visited = [[-1] * c for _ in range(r)] fire_queue = deque() jihun_queue = deque() fire_queue.append(fires) jihun_queue.append([jihun]) is_jihun_Visited[jihun[0]][jih.. 2024. 6. 10. 이전 1 다음