結果

問題 No.2674 k-Walk on Bipartite
ユーザー miho-4miho-4
提出日時 2024-03-15 22:22:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 111,692 KB
最終ジャッジ日時 2024-03-15 22:22:13
合計ジャッジ時間 7,084 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,600 KB
testcase_01 AC 41 ms
55,600 KB
testcase_02 AC 40 ms
55,600 KB
testcase_03 AC 41 ms
55,600 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 41 ms
55,600 KB
testcase_07 AC 293 ms
104,884 KB
testcase_08 AC 318 ms
104,420 KB
testcase_09 AC 190 ms
96,352 KB
testcase_10 AC 387 ms
111,692 KB
testcase_11 AC 310 ms
101,316 KB
testcase_12 AC 327 ms
103,088 KB
testcase_13 AC 199 ms
98,752 KB
testcase_14 AC 112 ms
86,184 KB
testcase_15 AC 386 ms
106,656 KB
testcase_16 AC 330 ms
107,836 KB
testcase_17 AC 304 ms
104,364 KB
testcase_18 AC 149 ms
91,060 KB
testcase_19 AC 201 ms
95,620 KB
testcase_20 AC 182 ms
92,792 KB
testcase_21 AC 347 ms
105,312 KB
testcase_22 AC 394 ms
108,820 KB
testcase_23 AC 43 ms
55,600 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 42 ms
55,600 KB
testcase_27 AC 42 ms
55,600 KB
testcase_28 AC 45 ms
55,600 KB
testcase_29 AC 43 ms
55,600 KB
testcase_30 AC 42 ms
55,600 KB
testcase_31 AC 53 ms
55,600 KB
testcase_32 AC 42 ms
55,600 KB
testcase_33 AC 42 ms
55,600 KB
testcase_34 AC 43 ms
55,600 KB
testcase_35 AC 45 ms
55,600 KB
testcase_36 AC 45 ms
55,600 KB
testcase_37 AC 44 ms
55,600 KB
testcase_38 AC 45 ms
55,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,m=map(int,input().split())
s,t,k=map(int,input().split())
edge=[list(map(int,input().split())) for _ in range(m)]

E=[[] for _ in range(n+1)]
for u,v in edge:
  E[v].append(u)
  E[u].append(v)
  
D=[10**9]*(n+1)
P=[-1]*(n+1)
D[s],P[s]=0,0
q=deque([(s)])
while q:
  x=q.popleft()
  for e in E[x]:
    if D[x]+1<D[e]:
      P[e]=P[x]^1
      D[e]=D[x]+1
      q.append(e)

if s==t and k%2==1:exit(print("No"))

if P[t]==0:
  if k%2==1:
    print("No")
  else:
    if D[t]<=k:
      print("Yes")
    else:
      print("Unknown")
elif P[t]==1:
  if k%2==0:
    print("No")
  else:
    if D[t]<=k:
      print("Yes")
    else:
      print("Unknown")
else:
  if n==1:print("No")
  elif n==2 and k%2==0:print("No")
  else:
    print("Unknown")
0