結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2015-12-31 02:28:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 680 ms / 5,000 ms |
コード長 | 780 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-19 08:55:26 |
合計ジャッジ時間 | 7,229 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
N,M,K = map(int, input().split())graph = [[[],[]] for i in range(N)]for i in range(M):a,b,c = map(int, input().split())graph[a-1][0].append(b-1)graph[a-1][1].append(c)graph[b-1][0].append(a-1)graph[b-1][1].append(c)d = list(map(int, input().split()))candidate = [True for i in range(N)]for i in range(K):next_candidate = [False for i in range(N)]for j in range(N):if not candidate[j]:continuefor k in range(len(graph[j][0])):nv = graph[j][0][k]cost = graph[j][1][k]if cost == d[i]:next_candidate[nv] = Truecandidate = next_candidate[:]ans = []for i in range(N):if candidate[i]:ans.append(i+1)ans.sort()print(len(ans))print(*ans)