結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2019-01-07 13:39:20 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 612 ms / 5,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-11-24 00:26:08 |
合計ジャッジ時間 | 5,475 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
N, M, K = [int(x) for x in input().split()] a = [0] * M b = [0] * M c = [0] * M for i in range(M): a[i], b[i], c[i] = [int(x) for x in input().split()] d = [int(x) for x in input().split()] pos = [[False] * (N + 1) for _ in range(K + 1)] for i in range(1, len(pos[0])): pos[0][i] = True for kk in range(K): for mm in range(M): if c[mm] == d[kk]: if pos[kk][a[mm]]: pos[kk + 1][b[mm]] = True if pos[kk][b[mm]]: pos[kk + 1][a[mm]] = True cnt = pos[K].count(True) lis = [] for nn, ok in enumerate(pos[K]): if ok: lis += [str(nn)] print(cnt) print(' '.join(lis))