[파이썬] 백준 2917 : 늑대사냥꾼 (골드2)
[파이썬] 백준 2917 : 늑대사냥꾼 (골드2)https://www.acmicpc.net/problem/2917풀이방향성 생각BFS로 거리 계산 후 다익스트라 전체코드from collections import dequeimport heapq as hqimport sysinput = lambda : sys.stdin.readline().rstrip()dire = [(1,0),(0,1),(-1,0),(0,-1)]inside = lambda x,y : 0 V[ny][nx]: V[ny][nx] = nd hq.heappush(heap,(-nd,nx,ny))print(V[ey][ex])코멘트.
2025. 1. 11.