結果

問題 No.92 逃走経路
ユーザー titiatitia
提出日時 2022-04-18 00:06:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 414 ms / 5,000 ms
コード長 328 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 8,376 KB
最終ジャッジ日時 2023-08-27 03:59:01
合計ジャッジ時間 4,990 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
8,292 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 AC 15 ms
7,852 KB
testcase_03 AC 16 ms
7,900 KB
testcase_04 AC 16 ms
7,764 KB
testcase_05 AC 414 ms
7,820 KB
testcase_06 AC 219 ms
8,212 KB
testcase_07 AC 218 ms
8,292 KB
testcase_08 AC 17 ms
7,844 KB
testcase_09 AC 38 ms
7,920 KB
testcase_10 AC 394 ms
7,772 KB
testcase_11 AC 373 ms
7,804 KB
testcase_12 AC 401 ms
7,824 KB
testcase_13 AC 31 ms
8,340 KB
testcase_14 AC 55 ms
8,376 KB
testcase_15 AC 91 ms
8,240 KB
testcase_16 AC 132 ms
8,252 KB
testcase_17 AC 231 ms
8,284 KB
testcase_18 AC 222 ms
8,336 KB
testcase_19 AC 220 ms
8,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K=map(int,input().split())
E=[tuple(map(int,input().split())) for i in range(M)]
D=list(map(int,input().split()))

Q=set(range(1,N+1))

for d in D:
    NQ=set()

    for a,b,c in E:
        if c==d and a in Q:
            NQ.add(b)
        if c==d and b in Q:
            NQ.add(a)

    Q=NQ

print(len(Q))
print(*sorted(Q))
0