結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-18 19:21:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 114 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-07-04 19:19:39 |
| 合計ジャッジ時間 | 1,810 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 1 |
ソースコード
from collections import defaultdict
N,M,K = [int(i) for i in input().split()]
G = [defaultdict(set) for i in range(N)]
for i in range(M):
a,b,c = map(int, input().split())
a -= 1
b -= 1
G[a][c].add(b)
G[b][c].add(a)
candidates = set(range(N))
for k in map(int, input().split()):
new_candidates = set([])
for i in candidates:
if k in G[i]:
new_candidates |= G[i][k]
candidates = new_candidates
print(len(candidates))
print(" ".join([str(i+1) for i in candidates]))