結果
問題 | No.1382 Travel in Mitaru city |
ユーザー |
![]() |
提出日時 | 2021-02-11 15:46:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 341 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 82,960 KB |
実行使用メモリ | 98,444 KB |
最終ジャッジ日時 | 2024-07-18 04:28:01 |
合計ジャッジ時間 | 15,962 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 68 |
ソースコード
from heapq import heappop, heappushn, m, s, t = map(int, input().split())s -= 1t -= 1p = list(map(int, input().split()))to = [[] for _ in range(n)]for _ in range(m):a, b = map(int, input().split())a -= 1b -= 1to[a].append(b)to[b].append(a)added = [False] * nadded[s] = Trueq = [(-p[s], s)]x, y = p[s], 0while q:pi, i = heappop(q)pi = -piif pi < x:x = piy += 1for v in to[i]:if added[v]:continueadded[v] = Trueheappush(q, (-p[v], v))print(y)