結果

問題 No.92 逃走経路
ユーザー 👑 rin204rin204
提出日時 2022-01-20 10:19:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 473 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 75,776 KB
最終ジャッジ日時 2024-05-02 20:18:50
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,296 KB
testcase_01 AC 42 ms
51,840 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 41 ms
51,840 KB
testcase_04 AC 41 ms
51,712 KB
testcase_05 AC 107 ms
66,304 KB
testcase_06 AC 80 ms
66,816 KB
testcase_07 AC 81 ms
66,688 KB
testcase_08 AC 55 ms
60,416 KB
testcase_09 AC 64 ms
69,376 KB
testcase_10 AC 107 ms
69,760 KB
testcase_11 AC 106 ms
71,040 KB
testcase_12 AC 118 ms
75,776 KB
testcase_13 AC 59 ms
64,640 KB
testcase_14 AC 69 ms
67,712 KB
testcase_15 AC 74 ms
69,632 KB
testcase_16 AC 71 ms
67,456 KB
testcase_17 AC 85 ms
71,168 KB
testcase_18 AC 78 ms
68,224 KB
testcase_19 AC 73 ms
67,328 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