숨바꼭질보다 조금 쉬운 하위문제 느낌? 어차피 이동의 모든 가중치는 같으므로 따로 우선순위큐나 appendleft없이 차례로 탐색하면 된다. 어차피 먼저 도착하면 먼저 출력된다. import sys input = sys.stdin.readline from collections import deque def BFS(F,S,G,U,D): dp_count = {i:float('inf') for i in range(1,F+1)} dp_count[S] = 0 queue = deque() queue.append(S) while queue: cur_stair = queue.popleft() if cur_stair == G: print(dp_count[G]) return for next_stair in (cur_sta..