結果

問題 No.2674 k-Walk on Bipartite
ユーザー i_am_noobi_am_noob
提出日時 2024-03-21 02:27:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 100,968 KB
最終ジャッジ日時 2024-03-21 02:27:41
合計ジャッジ時間 10,745 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
68,004 KB
testcase_01 AC 60 ms
68,004 KB
testcase_02 AC 59 ms
68,004 KB
testcase_03 AC 86 ms
68,004 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 61 ms
68,004 KB
testcase_07 AC 331 ms
96,420 KB
testcase_08 AC 408 ms
93,680 KB
testcase_09 AC 234 ms
93,784 KB
testcase_10 AC 487 ms
96,804 KB
testcase_11 AC 384 ms
93,000 KB
testcase_12 AC 466 ms
93,848 KB
testcase_13 AC 215 ms
92,440 KB
testcase_14 AC 120 ms
83,768 KB
testcase_15 AC 534 ms
99,032 KB
testcase_16 AC 435 ms
97,100 KB
testcase_17 AC 402 ms
93,000 KB
testcase_18 AC 159 ms
88,436 KB
testcase_19 AC 251 ms
91,944 KB
testcase_20 AC 206 ms
92,808 KB
testcase_21 AC 423 ms
94,660 KB
testcase_22 AC 613 ms
100,968 KB
testcase_23 AC 61 ms
68,004 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 61 ms
68,004 KB
testcase_27 AC 61 ms
68,004 KB
testcase_28 AC 62 ms
68,004 KB
testcase_29 AC 60 ms
68,004 KB
testcase_30 AC 61 ms
68,004 KB
testcase_31 AC 60 ms
68,004 KB
testcase_32 AC 62 ms
68,004 KB
testcase_33 AC 61 ms
68,004 KB
testcase_34 AC 61 ms
68,004 KB
testcase_35 AC 61 ms
68,004 KB
testcase_36 AC 62 ms
68,004 KB
testcase_37 AC 62 ms
68,004 KB
testcase_38 AC 60 ms
68,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
s, t, k = map(int, input().split())
s -= 1
t -= 1
adj = [[] for i in range(n)]
for i in range(m):
	u, v = map(int, input().split())
	u -= 1
	v -= 1
	adj[u].append(v)
	adj[v].append(u)

dis = [1000000000 for i in range(n)]

from queue import *
q = Queue()

q.put(s)
dis[s] = 0

while not q.empty():
	u = q.get()
	q.task_done()
	for v in adj[u]:
		if dis[v] > dis[u] + 1:
			dis[v] = dis[u] + 1
			q.put(v)

if dis[t] < 1000000000:
	if (dis[t] + k) % 2:
		print("No")
	elif dis[t] <= k:
		print("Yes")
	else:
		print("Unknown")
elif k % 2:
	print("Unknown")
else:
	print("No" if n == 2 else "Unknown")
0