結果
問題 | No.1382 Travel in Mitaru city |
ユーザー |
![]() |
提出日時 | 2021-02-07 21:09:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 339 ms / 2,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 96,128 KB |
最終ジャッジ日時 | 2024-07-04 14:22:46 |
合計ジャッジ時間 | 14,635 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 68 |
ソースコード
import sysinput = sys.stdin.readlineimport heapqN,M,S,T=map(int,input().split())P=[-1]+list(map(int,input().split()))E=[[] for i in range(N+1)]for i in range(M):a,b=map(int,input().split())E[a].append(b)E[b].append(a)X=-P[S]Q=[(-P[S],S)]ANS=0USE=[0]*(N+1)while Q:p,now=heapq.heappop(Q)if X<p:ANS+=1X=pfor to in E[now]:if USE[to]==0:USE[to]=1heapq.heappush(Q,(-P[to],to))print(ANS)