結果

問題 No.1382 Travel in Mitaru city
ユーザー H3PO4H3PO4
提出日時 2021-02-07 20:46:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 11,016 KB
実行使用メモリ 62,088 KB
最終ジャッジ日時 2023-09-17 19:34:27
合計ジャッジ時間 36,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
43,104 KB
testcase_01 AC 200 ms
42,904 KB
testcase_02 AC 197 ms
43,240 KB
testcase_03 AC 198 ms
43,088 KB
testcase_04 AC 199 ms
43,036 KB
testcase_05 AC 200 ms
43,304 KB
testcase_06 WA -
testcase_07 AC 422 ms
50,336 KB
testcase_08 WA -
testcase_09 AC 534 ms
54,208 KB
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 WA -
testcase_27 AC 604 ms
59,752 KB
testcase_28 AC 595 ms
59,560 KB
testcase_29 AC 594 ms
59,868 KB
testcase_30 AC 587 ms
59,556 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 524 ms
56,936 KB
testcase_37 AC 252 ms
45,348 KB
testcase_38 AC 553 ms
58,592 KB
testcase_39 AC 294 ms
46,604 KB
testcase_40 AC 462 ms
54,384 KB
testcase_41 AC 516 ms
56,144 KB
testcase_42 AC 566 ms
58,816 KB
testcase_43 AC 510 ms
56,780 KB
testcase_44 AC 328 ms
48,772 KB
testcase_45 AC 496 ms
55,168 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 443 ms
53,560 KB
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 AC 218 ms
43,440 KB
testcase_62 AC 201 ms
43,300 KB
testcase_63 AC 306 ms
43,404 KB
testcase_64 AC 224 ms
43,744 KB
testcase_65 AC 199 ms
43,292 KB
testcase_66 AC 212 ms
43,372 KB
testcase_67 AC 221 ms
43,672 KB
testcase_68 AC 237 ms
43,348 KB
testcase_69 AC 215 ms
43,464 KB
testcase_70 AC 251 ms
43,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

N, M, S, T = map(int, input().split())
S -= 1
T -= 1
P = tuple(map(int, input().split()))
frm, to = [0] * M, [0] * M
for i in range(M):
    a, b = (int(x) - 1 for x in input().split())
    frm[i] = a
    to[i] = b

matr = csr_matrix(([1] * M, (frm, to)), shape=(N, N))
p, labels = connected_components(matr)

ls, ps = labels[S], P[S]
st = set()
for x, p in zip(labels, P):
    if x == ls and p < ps:
        st.add(p)
print(len(st))
0