結果

問題 No.92 逃走経路
ユーザー LyricalMaestroLyricalMaestro
提出日時 2024-01-23 00:54:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 740 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 66,072 KB
最終ジャッジ日時 2024-01-23 00:54:13
合計ジャッジ時間 2,619 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
66,056 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 91 ms
65,944 KB
testcase_06 AC 56 ms
66,072 KB
testcase_07 AC 57 ms
66,068 KB
testcase_08 AC 43 ms
61,852 KB
testcase_09 AC 42 ms
61,832 KB
testcase_10 AC 66 ms
65,944 KB
testcase_11 AC 64 ms
65,944 KB
testcase_12 AC 71 ms
65,944 KB
testcase_13 AC 42 ms
59,704 KB
testcase_14 AC 47 ms
61,840 KB
testcase_15 AC 49 ms
63,896 KB
testcase_16 AC 53 ms
63,888 KB
testcase_17 AC 60 ms
66,068 KB
testcase_18 AC 58 ms
66,068 KB
testcase_19 AC 58 ms
66,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/92

def main():
    N, M, K = map(int, input().split())
    money_map = {}
    for _ in range(M):
        a, b, c = map(int, input().split())
        if c not in money_map:
            money_map[c] = []
        money_map[c].append((a - 1, b - 1))
        money_map[c].append((b - 1, a - 1))
    D = list(map(int, input().split()))

    array = [True] * N
    for d in D:
        new_array = [False] * N

        for a, b in money_map[d]:
            new_array[b] |= array[a]
        array = new_array

    answer = []    
    for i in range(N):
        if array[i]:
            answer.append(str(i + 1))
    print(len(answer))
    print(' '.join(answer))

    






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