結果
| 問題 |
No.1382 Travel in Mitaru city
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-07 22:12:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 372 ms / 2,000 ms |
| コード長 | 486 bytes |
| コンパイル時間 | 291 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 98,844 KB |
| 最終ジャッジ日時 | 2024-07-04 15:49:36 |
| 合計ジャッジ時間 | 16,352 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 68 |
ソースコード
n,m,s,t = map(int,input().split())
*p, = map(int,input().split())
g = [[] for _ in range(n)]
for _ in range(m):
a,b = map(int,input().split())
g[a-1].append(b-1)
g[b-1].append(a-1)
s -= 1; t -= 1
from heapq import *
q = [(-p[s],s)]
used = [0]*n
used[s] = 0
ans = 0
X = p[s]
while q:
x,v = heappop(q)
x = -x
if X > x:
X = x
ans += 1
for c in g[v]:
if used[c] == 0:
heappush(q,(-p[c],c))
used[c] = 1
print(ans)
convexineq