結果

問題 No.92 逃走経路
ユーザー 👑 H20H20
提出日時 2021-08-03 13:10:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,513 ms / 5,000 ms
コード長 512 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 77,252 KB
最終ジャッジ日時 2023-10-14 21:08:23
合計ジャッジ時間 12,489 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 607 ms
76,832 KB
testcase_01 AC 78 ms
71,252 KB
testcase_02 AC 79 ms
71,376 KB
testcase_03 AC 78 ms
71,356 KB
testcase_04 AC 79 ms
71,396 KB
testcase_05 AC 129 ms
76,628 KB
testcase_06 AC 107 ms
76,480 KB
testcase_07 AC 107 ms
76,400 KB
testcase_08 AC 86 ms
76,216 KB
testcase_09 AC 93 ms
77,012 KB
testcase_10 AC 1,560 ms
77,164 KB
testcase_11 AC 1,010 ms
76,900 KB
testcase_12 AC 2,513 ms
77,192 KB
testcase_13 AC 105 ms
76,908 KB
testcase_14 AC 424 ms
76,896 KB
testcase_15 AC 591 ms
76,836 KB
testcase_16 AC 467 ms
77,064 KB
testcase_17 AC 854 ms
76,856 KB
testcase_18 AC 516 ms
77,252 KB
testcase_19 AC 158 ms
76,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int,input().split())
L = [[] for _ in range(N+1)] 
for i in range(M):
    a,b,c = map(int,input().split())
    L[a].append((b,c))
    L[b].append((a,c))
D = list(map(int,input().split()))[::-1]
ANS = []
for i in range(1,N+1):
    S = set()
    S.add(i)
    for d in D:
        NEXT = set()
        for s in S:
            for l in L[s]:
                n,c = l
                if d==c:
                    NEXT.add(n)
        S = NEXT
    if len(S):
        ANS.append(i)
print(len(ANS))
print(*ANS)
0