結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2017-05-05 12:32:09 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 94 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-09-14 08:40:54 |
合計ジャッジ時間 | 2,210 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 104 ms
11,904 KB |
testcase_01 | AC | 31 ms
10,624 KB |
testcase_02 | AC | 30 ms
10,624 KB |
testcase_03 | AC | 29 ms
10,624 KB |
testcase_04 | AC | 30 ms
10,624 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 | 59 ms
11,776 KB |
testcase_14 | AC | 64 ms
11,776 KB |
testcase_15 | AC | 84 ms
11,776 KB |
testcase_16 | AC | 77 ms
11,776 KB |
testcase_17 | AC | 94 ms
11,776 KB |
testcase_18 | AC | 91 ms
11,392 KB |
testcase_19 | AC | 86 ms
11,264 KB |
ソースコード
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].append((b-1,c)) graph[b-1].append((a-1,c)) d = [int(i) for i in input().split()] used = [[False for j in range(K)]for i in range(N)] ans = set([]) def dfs(n,c): if c == K: global ans ans.add(n+1) return if used[n][c]: return used[n][c] = True for e in graph[n]: if e[1] == d[c]: dfs(e[0],c+1) for i in range(N): dfs(i,0) print(len(ans)) print(' '.join(str(i) for i in sorted(list(ans))))