結果
問題 | No.92 逃走経路 |
ユーザー | ntuda |
提出日時 | 2024-01-05 22:59:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 75,916 KB |
最終ジャッジ日時 | 2024-01-05 22:59:07 |
合計ジャッジ時間 | 2,915 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 34 ms
53,328 KB |
testcase_02 | AC | 35 ms
53,328 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 87 ms
68,556 KB |
testcase_06 | AC | 62 ms
68,552 KB |
testcase_07 | AC | 70 ms
68,552 KB |
testcase_08 | AC | 45 ms
62,248 KB |
testcase_09 | AC | 54 ms
70,472 KB |
testcase_10 | WA | - |
testcase_11 | AC | 91 ms
72,660 KB |
testcase_12 | AC | 100 ms
75,764 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
N, M, K = map(int, input().split()) ABC = [list(map(int, input().split())) for _ in range(M)] D = list(map(int, input().split())) E = [{} for _ in range(N + 1)] Q = set() for a, b, c in ABC: if c not in E[a]: E[a][c] = [b] else: E[a][c].append(b) if c not in E[b]: E[b][c] = [a] else: E[b][c].append(a) if c == D[0]: Q.add(a) Q.add(b) for i in range(K): Q2 = set() for q in Q: if D[i] in E[q]: for x in E[q][D[i]]: Q2.add(x) Q = Q2 print(len(Q)) print(*Q)