結果

問題 No.2674 k-Walk on Bipartite
ユーザー hiro1729hiro1729
提出日時 2024-03-15 22:09:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 98,380 KB
最終ジャッジ日時 2024-03-15 22:09:39
合計ジャッジ時間 7,899 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,612 KB
testcase_01 AC 45 ms
55,612 KB
testcase_02 AC 43 ms
55,612 KB
testcase_03 AC 42 ms
55,612 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 41 ms
55,612 KB
testcase_07 AC 290 ms
92,944 KB
testcase_08 AC 331 ms
89,944 KB
testcase_09 RE -
testcase_10 AC 400 ms
92,920 KB
testcase_11 RE -
testcase_12 AC 391 ms
90,240 KB
testcase_13 RE -
testcase_14 AC 105 ms
83,212 KB
testcase_15 AC 495 ms
95,480 KB
testcase_16 AC 322 ms
94,644 KB
testcase_17 AC 334 ms
89,648 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 216 ms
92,404 KB
testcase_21 AC 340 ms
90,920 KB
testcase_22 RE -
testcase_23 AC 41 ms
55,612 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 41 ms
55,612 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 42 ms
55,612 KB
testcase_32 AC 42 ms
55,612 KB
testcase_33 AC 43 ms
55,612 KB
testcase_34 AC 44 ms
55,612 KB
testcase_35 AC 42 ms
55,612 KB
testcase_36 AC 42 ms
55,612 KB
testcase_37 AC 43 ms
55,612 KB
testcase_38 AC 51 ms
55,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N, M = map(int, input().split())
s, t, k = map(int, input().split())
s -= 1
t -= 1
g = [[] for _ in range(N)]
for _ in range(M):
	u, v = map(int, input().split())
	u -= 1
	v -= 1
	g[u].append(v)
	g[v].append(u)
d = [10 ** 9] * N
d[s] = 0
q = deque([s])
while q:
	u = q.popleft()
	for v in g[u]:
		if d[u] + 1 < d[v]:
			d[v] = d[u] + 1
			q.append(v)
if d[t] < 10 ** 9:
	if d[t] % 2 == k % 2:
		print("Yes" if d[t] <= k else "Unknown")
	else:
		print("No")
else:
	assert(False)
0