結果

問題 No.92 逃走経路
ユーザー 👑 rin204rin204
提出日時 2022-01-20 10:19:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 473 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 77,028 KB
最終ジャッジ日時 2023-08-15 08:36:44
合計ジャッジ時間 3,185 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
76,404 KB
testcase_01 AC 68 ms
71,232 KB
testcase_02 AC 67 ms
71,036 KB
testcase_03 AC 68 ms
71,352 KB
testcase_04 AC 67 ms
70,996 KB
testcase_05 AC 116 ms
76,196 KB
testcase_06 AC 98 ms
76,200 KB
testcase_07 AC 99 ms
76,260 KB
testcase_08 AC 75 ms
76,012 KB
testcase_09 AC 79 ms
76,244 KB
testcase_10 AC 118 ms
76,276 KB
testcase_11 AC 116 ms
76,284 KB
testcase_12 AC 121 ms
77,028 KB
testcase_13 AC 80 ms
76,048 KB
testcase_14 AC 90 ms
75,920 KB
testcase_15 AC 90 ms
76,132 KB
testcase_16 AC 87 ms
76,056 KB
testcase_17 AC 101 ms
76,224 KB
testcase_18 AC 97 ms
76,236 KB
testcase_19 AC 93 ms
76,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, k = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append((b, c))
    edges[b].append((a, c))
D = list(map(int, input().split()))
se = set(range(n))
for d in D:
    se2 = set()
    for pos in se:
        for npos, c in edges[pos]:
            if c == d:
                se2.add(npos)
    se = se2
    
print(len(se))
lst = sorted(se)
print(*(l + 1 for l in lst))
0