結果

問題 No.2674 k-Walk on Bipartite
ユーザー mkawa2mkawa2
提出日時 2024-03-15 22:40:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,269 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 97,440 KB
最終ジャッジ日時 2024-03-15 22:40:55
合計ジャッジ時間 6,712 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,608 KB
testcase_01 AC 43 ms
55,608 KB
testcase_02 AC 41 ms
55,608 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 230 ms
93,404 KB
testcase_08 AC 299 ms
91,000 KB
testcase_09 AC 187 ms
92,432 KB
testcase_10 AC 377 ms
93,100 KB
testcase_11 AC 249 ms
90,064 KB
testcase_12 AC 326 ms
91,296 KB
testcase_13 AC 182 ms
90,676 KB
testcase_14 AC 90 ms
83,392 KB
testcase_15 AC 402 ms
95,020 KB
testcase_16 AC 273 ms
94,724 KB
testcase_17 AC 277 ms
89,552 KB
testcase_18 AC 130 ms
85,884 KB
testcase_19 AC 207 ms
91,844 KB
testcase_20 AC 191 ms
91,840 KB
testcase_21 AC 290 ms
91,468 KB
testcase_22 AC 391 ms
97,440 KB
testcase_23 WA -
testcase_24 AC 42 ms
55,608 KB
testcase_25 AC 42 ms
55,608 KB
testcase_26 WA -
testcase_27 AC 41 ms
55,608 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 41 ms
55,608 KB
testcase_31 AC 41 ms
55,608 KB
testcase_32 AC 42 ms
55,608 KB
testcase_33 AC 41 ms
55,608 KB
testcase_34 AC 41 ms
55,608 KB
testcase_35 AC 41 ms
55,608 KB
testcase_36 AC 41 ms
55,608 KB
testcase_37 AC 41 ms
55,608 KB
testcase_38 AC 41 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

from collections import deque

n,m=LI()
s,t,k=LI()
s,t=s-1,t-1
to=[[] for _ in range(n)]
for _ in range(m):
    u,v=LI1()
    to[u].append(v)
    to[v].append(u)

dist=[-1]*n
dist[s]=0
q=deque()
q.append(s)
while q:
    u=q.popleft()
    for v in to[u]:
        if dist[v]==-1:
            dist[v]=dist[u]+1
            q.append(v)

if not to[s] or dist[t]==-1:
    print("Unknown")
elif dist[t]&1==k&1:
    if dist[t]<=k:
        print("Yes")
    else:
        print("Unknown")
else:
    print("No")
0