NISHIO Hirokazu[Translate]
PAST202005M



python
graph = lil_matrix((N + 1, N + 1)) for i in range(M): v1, v2 = map(int, input().split()) graph[v1, v2] = 1 graph[v2, v1] = 1 start = int(input()) K = int(input()) targets = list(map(int, input().split())) dist = dijkstra(graph, indices=targets) print(dist)


"Engineer's way of creating knowledge" the English version of my book is now available on [Engineer's way of creating knowledge]

(C)NISHIO Hirokazu / Converted from [Scrapbox] at [Edit]