結果

問題 No.2674 k-Walk on Bipartite
ユーザー Today03Today03
提出日時 2024-03-16 06:37:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 41,344 KB
最終ジャッジ日時 2024-03-16 06:37:23
合計ジャッジ時間 14,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 AC 30 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 30 ms
9,984 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 29 ms
9,984 KB
testcase_07 AC 544 ms
34,176 KB
testcase_08 AC 763 ms
31,744 KB
testcase_09 WA -
testcase_10 AC 956 ms
36,224 KB
testcase_11 WA -
testcase_12 AC 1,035 ms
34,048 KB
testcase_13 WA -
testcase_14 AC 148 ms
23,424 KB
testcase_15 AC 1,026 ms
38,656 KB
testcase_16 AC 662 ms
36,096 KB
testcase_17 AC 753 ms
30,720 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 440 ms
33,280 KB
testcase_21 AC 824 ms
32,768 KB
testcase_22 WA -
testcase_23 AC 29 ms
9,984 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 29 ms
9,984 KB
testcase_27 WA -
testcase_28 AC 29 ms
9,984 KB
testcase_29 AC 29 ms
9,984 KB
testcase_30 WA -
testcase_31 AC 29 ms
9,984 KB
testcase_32 AC 29 ms
9,984 KB
testcase_33 AC 29 ms
9,984 KB
testcase_34 AC 29 ms
9,984 KB
testcase_35 AC 28 ms
9,984 KB
testcase_36 AC 28 ms
9,984 KB
testcase_37 AC 28 ms
9,984 KB
testcase_38 AC 28 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque


N, M = map(int, input().split())
S, T, K = map(int, input().split())
S, T = S - 1, T - 1
G = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A, B = A - 1, B - 1
    G[A].append(B)
    G[B].append(A)

D = [10**9] * N
D[S] = 0
Q = deque()
Q.append(S)

while Q:
    now = Q.popleft()
    for nxt in G[now]:
        if D[nxt] > D[now] + 1:
            D[nxt] = D[now] + 1
            Q.append(nxt)

if D[T] == 10**9 or D[T] % 2 != K % 2:
    print("No")
elif D[T] <= K:
    print("Yes")
else:
    print("Unknown")
0