結果
問題 | No.92 逃走経路 |
ユーザー | tookunn_1213 |
提出日時 | 2017-05-05 12:32:09 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 10,964 KB |
実行使用メモリ | 9,556 KB |
最終ジャッジ日時 | 2023-10-12 09:46:45 |
合計ジャッジ時間 | 2,099 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 81 ms
9,472 KB |
testcase_01 | AC | 16 ms
7,816 KB |
testcase_02 | AC | 16 ms
7,964 KB |
testcase_03 | AC | 15 ms
7,920 KB |
testcase_04 | AC | 16 ms
7,812 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 | 40 ms
9,352 KB |
testcase_14 | AC | 46 ms
9,496 KB |
testcase_15 | AC | 64 ms
9,308 KB |
testcase_16 | AC | 56 ms
9,412 KB |
testcase_17 | AC | 74 ms
9,244 KB |
testcase_18 | AC | 74 ms
8,960 KB |
testcase_19 | AC | 69 ms
8,712 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))))