結果
問題 |
No.92 逃走経路
|
ユーザー |
![]() |
提出日時 | 2020-03-28 16:31:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 821 bytes |
コンパイル時間 | 434 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 24,856 KB |
最終ジャッジ日時 | 2025-01-02 11:44:04 |
合計ジャッジ時間 | 56,566 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 RE * 8 TLE * 8 |
ソースコード
n, m ,k = list(map(int, input().split(' '))) abcm = [None] * m for i in range(m): abcm[i] = list(map(int, input().split(' '))) dk = list(map(int, input().split(' '))) def solver(cp, x): if x == k: return [cp] result = [] for i in range(m): bg = abcm[i] if bg[0] == cp and bg[2] == dk[x]: r = solver(bg[1], x + 1) if len(r) != 0: result.extend(r) elif bg[1] == cp and bg[2] == dk[x]: r = solver(bg[0], x + 1) if len(r) != 0: result.extend(r) return result c = 0 cps = set() for i in range(1, n + 1): result = solver(i, 0) c += len(result) for j in result: cps.add(j) cps = sorted(cps) print(c) for i in range(c): print(cps[i] ,end=' ') print()