結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,604 KB
testcase_01 AC 46 ms
55,604 KB
testcase_02 AC 47 ms
55,604 KB
testcase_03 AC 44 ms
55,604 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 46 ms
55,604 KB
testcase_07 AC 280 ms
104,884 KB
testcase_08 AC 337 ms
104,420 KB
testcase_09 AC 199 ms
96,352 KB
testcase_10 AC 402 ms
111,692 KB
testcase_11 AC 298 ms
101,316 KB
testcase_12 AC 336 ms
103,088 KB
testcase_13 AC 203 ms
98,752 KB
testcase_14 AC 114 ms
86,184 KB
testcase_15 AC 433 ms
106,528 KB
testcase_16 AC 309 ms
107,836 KB
testcase_17 AC 307 ms
104,492 KB
testcase_18 AC 154 ms
91,188 KB
testcase_19 AC 214 ms
95,620 KB
testcase_20 AC 190 ms
93,048 KB
testcase_21 AC 330 ms
105,312 KB
testcase_22 AC 416 ms
108,820 KB
testcase_23 AC 42 ms
55,604 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 43 ms
55,604 KB
testcase_27 AC 42 ms
55,604 KB
testcase_28 AC 43 ms
55,604 KB
testcase_29 AC 42 ms
55,604 KB
testcase_30 AC 43 ms
55,604 KB
testcase_31 AC 43 ms
55,604 KB
testcase_32 AC 42 ms
55,604 KB
testcase_33 AC 42 ms
55,604 KB
testcase_34 AC 42 ms
55,604 KB
testcase_35 AC 42 ms
55,604 KB
testcase_36 AC 42 ms
55,604 KB
testcase_37 AC 42 ms
55,604 KB
testcase_38 AC 42 ms
55,604 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 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