結果

問題 No.1190 Points
ユーザー buey_tbuey_t
提出日時 2023-04-23 10:12:37
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 1,641 bytes
コンパイル時間 1,191 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 358,644 KB
最終ジャッジ日時 2023-08-07 14:09:14
合計ジャッジ時間 5,914 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
82,852 KB
testcase_01 AC 226 ms
82,136 KB
testcase_02 AC 229 ms
82,220 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
from heapq import heapify, heappop, heappush
from bisect import bisect_left, bisect_right
from copy import deepcopy
import copy
import random
from collections import deque,Counter,defaultdict
from itertools import permutations,combinations
from decimal import Decimal,ROUND_HALF_UP
#tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
from functools import lru_cache, reduce
#@lru_cache(maxsize=None)
from operator import add,sub,mul,xor,and_,or_,itemgetter
import sys
input = sys.stdin.readline
# .rstrip()
INF = 10**18
mod1 = 10**9+7
mod2 = 998244353

#DecimalならPython
#再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!!


'''
dfsじゃないといけないかも
頂点Gまでの経路
まあ普通にP回まで探索すればいいけど
それまでに通った辺をどうやって管理するか
重複していいならリストでいいのか
'''

N,M,P = map(int, input().split())
S,Go = map(int, input().split())

G = [[] for _ in range(N+1)]

for _ in range(M):
    u,v = map(int, input().split())
    G[u].append(v)
    G[v].append(u)

Q = deque()
Q.append((S,[]))
ans = set()

while len(Q) > 0:
    pos = Q[0][0]
    ls = deepcopy(Q[0][1])
    Q.popleft()
    
    ls.append(pos)
    
    if len(ls) > P+1:
        break
    if len(ls) == P+1:
        if pos == Go:
            for i in ls:
                ans.add(i)
        continue
    
    for nx in G[pos]:
        Q.append((nx,ls))

if len(ans) == 0:
    print(-1)
    exit()

print(len(ans))
ans = list(ans)
ans.sort()
for a in ans:
    print(a)





















0