結果
| 問題 | No.92 逃走経路 |
| コンテスト | |
| ユーザー |
yaoshimax
|
| 提出日時 | 2015-03-02 01:19:46 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 677 ms / 5,000 ms |
| コード長 | 555 bytes |
| 記録 | |
| コンパイル時間 | 244 ms |
| コンパイル使用メモリ | 77,520 KB |
| 最終ジャッジ日時 | 2025-12-03 14:23:47 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
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,
yaoshimax