PAST202005M
https://atcoder.jp/contests/past202005-open/tasks/past202005_m
scipy.sparse.csgraph
https://docs.scipy.org/doc/scipy/reference/sparse.csgraph.html#module-scipy.sparse.csgraph
code: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)