結果

問題 No.1382 Travel in Mitaru city
ユーザー H3PO4H3PO4
提出日時 2021-02-07 21:44:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 70,740 KB
最終ジャッジ日時 2023-09-17 21:08:05
合計ジャッジ時間 36,350 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,108 KB
testcase_01 AC 17 ms
8,108 KB
testcase_02 AC 16 ms
7,936 KB
testcase_03 AC 16 ms
8,048 KB
testcase_04 AC 16 ms
8,040 KB
testcase_05 AC 16 ms
7,968 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 723 ms
31,764 KB
testcase_27 WA -
testcase_28 AC 727 ms
31,676 KB
testcase_29 AC 739 ms
31,768 KB
testcase_30 AC 736 ms
31,664 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 220 ms
17,384 KB
testcase_36 AC 366 ms
25,868 KB
testcase_37 AC 73 ms
11,064 KB
testcase_38 AC 416 ms
28,004 KB
testcase_39 AC 116 ms
13,168 KB
testcase_40 AC 306 ms
22,900 KB
testcase_41 AC 344 ms
24,724 KB
testcase_42 AC 412 ms
28,252 KB
testcase_43 AC 369 ms
25,640 KB
testcase_44 AC 151 ms
15,100 KB
testcase_45 AC 333 ms
24,008 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 TLE -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N, M, S, T = map(int, input().split())
S -= 1
T -= 1
P = tuple(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
    a, b = (int(x) - 1 for x in input().split())
    G[a].append(b)
    G[b].append(a)

h = [(-P[S], S)]
nonvisited = [True] * N
ans = 0
X = P[S]
while h:
    p, v = heapq.heappop(h)
    if -p < X:
        X = -p
        ans += 1
    nonvisited[v] = False
    for x in G[v]:
        if nonvisited[x]:
            h.append((-P[x], x))
print(ans)
0