結果

問題 No.1190 Points
ユーザー ああいいああいい
提出日時 2022-02-23 11:46:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 1,644 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 120,524 KB
最終ジャッジ日時 2023-09-14 04:07:30
合計ジャッジ時間 14,869 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,716 KB
testcase_01 AC 92 ms
71,508 KB
testcase_02 AC 93 ms
71,736 KB
testcase_03 AC 377 ms
102,436 KB
testcase_04 AC 342 ms
98,124 KB
testcase_05 AC 338 ms
101,216 KB
testcase_06 AC 438 ms
105,320 KB
testcase_07 AC 454 ms
114,868 KB
testcase_08 AC 408 ms
117,388 KB
testcase_09 AC 514 ms
114,156 KB
testcase_10 AC 432 ms
119,080 KB
testcase_11 AC 383 ms
104,200 KB
testcase_12 AC 471 ms
116,024 KB
testcase_13 AC 458 ms
98,036 KB
testcase_14 WA -
testcase_15 AC 632 ms
115,020 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 358 ms
93,748 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 651 ms
118,724 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P = map(int,input().split())
S,GG = 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)
inf = 10 ** 8
ds = [[inf] * 2 for _ in range(N+1)]
dg = [[inf] * 2 for _ in range(N+1)]
ds[S][0] = 0
dg[GG][0] = 0
from collections import deque
q = deque()
q.append((S,0))
while q:
    now,flag = q.popleft()
    for v in G[now]:
        if ds[v][1-flag] == inf:
            ds[v][1-flag] = ds[now][flag] + 1
            q.append((v,1-flag))
q.append((GG,0))
while q:
    now,flag = q.popleft()
    for v in G[now]:
        if dg[v][1-flag] == inf:
            dg[v][1-flag] = dg[now][flag] + 1
            q.append((v,1-flag))
ans = []
if P % 2 == 0:
    for i in range(1,N+1):
        if ds[i][0] + dg[i][0] <= P or ds[i][1] + dg[i][1] <= P:
            ans.append(i)
else:
    for i in range(1,N+1):
        if ds[i][1] + dg[i][0] <= P or ds[i][0] + dg[i][1] <= P:
            ans.append(i)
if len(ans) == 0:
    print(-1)
else:
    print(len(ans))
    print(*ans,sep="\n")
0