結果

問題 No.92 逃走経路
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-02 01:19:46
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 555 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 6,600 KB
実行使用メモリ 32,536 KB
最終ジャッジ日時 2023-09-06 06:15:00
合計ジャッジ時間 12,049 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4,002 ms
6,956 KB
testcase_01 AC 10 ms
5,840 KB
testcase_02 AC 10 ms
5,884 KB
testcase_03 AC 10 ms
5,968 KB
testcase_04 AC 11 ms
5,912 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 49 ms
6,508 KB
testcase_14 AC 1,095 ms
6,464 KB
testcase_15 AC 100 ms
6,888 KB
testcase_16 AC 142 ms
6,804 KB
testcase_17 AC 207 ms
7,152 KB
testcase_18 AC 162 ms
7,328 KB
testcase_19 AC 148 ms
7,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K=map(int,raw_input().split())
edge=[[]for i in range(N)]
for i in range(M):
    a,b,c = map(int,raw_input().split())
    edge[a-1].append((b-1,c))
    edge[b-1].append((a-1,c))
d=map(int,raw_input().split())
d.reverse()
ans = []

def dfs(cur,depth):
    if depth==K:
        return True
    for i in range(len(edge[cur])):
        nxt,cost = edge[cur][i]
        if cost == d[depth] and dfs(nxt,depth+1):
            return True
    return False

for i in range(N):
    if dfs(i,0):
        ans.append(i)
print len(ans)
for a in ans:
    print a+1,

0