結果

問題 No.92 逃走経路
ユーザー 👑 KazunKazun
提出日時 2021-02-07 19:36:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 86,536 KB
実行使用メモリ 77,512 KB
最終ジャッジ日時 2023-09-17 18:00:42
合計ジャッジ時間 3,573 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
77,268 KB
testcase_01 AC 88 ms
71,692 KB
testcase_02 AC 89 ms
71,328 KB
testcase_03 AC 87 ms
71,332 KB
testcase_04 AC 87 ms
71,688 KB
testcase_05 AC 144 ms
77,204 KB
testcase_06 AC 105 ms
76,304 KB
testcase_07 AC 107 ms
76,316 KB
testcase_08 AC 89 ms
71,668 KB
testcase_09 AC 105 ms
77,372 KB
testcase_10 AC 149 ms
77,344 KB
testcase_11 AC 144 ms
77,196 KB
testcase_12 AC 150 ms
77,348 KB
testcase_13 AC 102 ms
77,512 KB
testcase_14 AC 111 ms
77,396 KB
testcase_15 AC 113 ms
77,148 KB
testcase_16 AC 119 ms
77,424 KB
testcase_17 AC 123 ms
77,368 KB
testcase_18 AC 119 ms
77,368 KB
testcase_19 AC 117 ms
77,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N,M,K=map(int,input().split())
E=defaultdict(list)
for _ in range(M):
    a,b,c=map(int,input().split())
    E[c].append((a,b))
D=map(int,input().split())

S=set(range(1,N+1))
for d in D:
    T=set()
    for u,v in E[d]:
        if u in S:
            T.add(v)
        if v in S:
            T.add(u)
    S=T.copy()

print(len(S))
print(*sorted(S))
0