結果

問題 No.92 逃走経路
ユーザー 👑 colognecologne
提出日時 2022-01-27 16:08:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 77,168 KB
最終ジャッジ日時 2023-08-26 16:38:36
合計ジャッジ時間 3,127 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 65 ms
71,132 KB
testcase_02 AC 63 ms
71,556 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 115 ms
77,040 KB
testcase_06 AC 82 ms
76,468 KB
testcase_07 AC 83 ms
76,128 KB
testcase_08 AC 70 ms
76,200 KB
testcase_09 AC 75 ms
76,444 KB
testcase_10 WA -
testcase_11 AC 113 ms
76,940 KB
testcase_12 AC 113 ms
76,884 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    N, M, K = map(int, input().split())
    abc = [list(map(int, input().split())) for i in range(M)]
    *d, = map(int, input().split())

    adj = [[] for i in range(N+1)]
    for a, b, c in abc:
        adj[a].append((b, c))
        adj[b].append((a, c))

    *cur, = range(1, N+1)
    for e in d:
        ncur = []
        for v in cur:
            for u, c in adj[v]:
                if c == e:
                    ncur.append(u)
        cur = list(set(ncur))

    print(len(cur))
    print(*cur)


if __name__ == '__main__':
    main()
0