結果

問題 No.92 逃走経路
ユーザー kutsutamakutsutama
提出日時 2019-01-07 13:39:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 630 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-05-03 03:33:20
合計ジャッジ時間 5,388 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 211 ms
11,392 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 630 ms
10,880 KB
testcase_06 AC 176 ms
10,880 KB
testcase_07 AC 178 ms
10,752 KB
testcase_08 AC 33 ms
11,648 KB
testcase_09 AC 60 ms
11,520 KB
testcase_10 AC 589 ms
11,136 KB
testcase_11 AC 569 ms
11,136 KB
testcase_12 AC 580 ms
11,520 KB
testcase_13 AC 54 ms
11,520 KB
testcase_14 AC 69 ms
11,648 KB
testcase_15 AC 103 ms
11,520 KB
testcase_16 AC 128 ms
11,520 KB
testcase_17 AC 231 ms
11,520 KB
testcase_18 AC 187 ms
11,264 KB
testcase_19 AC 191 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0