結果

問題 No.2674 k-Walk on Bipartite
ユーザー hiro1729hiro1729
提出日時 2024-03-15 22:32:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 517 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 97,868 KB
最終ジャッジ日時 2024-03-15 22:32:53
合計ジャッジ時間 8,204 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 226 ms
93,244 KB
testcase_10 RE -
testcase_11 AC 286 ms
89,772 KB
testcase_12 RE -
testcase_13 AC 216 ms
89,596 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 148 ms
85,212 KB
testcase_19 AC 239 ms
91,652 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 467 ms
97,868 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 42 ms
55,608 KB
testcase_28 AC 43 ms
55,612 KB
testcase_29 AC 41 ms
55,604 KB
testcase_30 AC 41 ms
55,608 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

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:
	assert(False)
else:
	if N == 2 and g[s] == [] and g[t] == [] and k % 2 == 0:
		print("No")
	else:
		print("Unknown")
0