結果
| 問題 | No.1382 Travel in Mitaru city |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 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 sys
input = sys.stdin.readline
import heapq
N,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=0
USE=[0]*(N+1)
while Q:
p,now=heapq.heappop(Q)
if X<p:
ANS+=1
X=p
for to in E[now]:
if USE[to]==0:
USE[to]=1
heapq.heappush(Q,(-P[to],to))
print(ANS)
titia