結果

問題 No.2674 k-Walk on Bipartite
ユーザー rlangevinrlangevin
提出日時 2024-03-19 00:07:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 99,032 KB
最終ジャッジ日時 2024-03-19 00:07:36
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
55,612 KB
testcase_01 AC 36 ms
55,612 KB
testcase_02 AC 40 ms
55,612 KB
testcase_03 AC 37 ms
55,612 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 37 ms
55,612 KB
testcase_07 AC 159 ms
94,356 KB
testcase_08 AC 177 ms
91,444 KB
testcase_09 AC 151 ms
91,720 KB
testcase_10 AC 213 ms
93,284 KB
testcase_11 AC 163 ms
90,760 KB
testcase_12 AC 196 ms
90,332 KB
testcase_13 AC 117 ms
90,092 KB
testcase_14 AC 76 ms
85,368 KB
testcase_15 AC 245 ms
96,612 KB
testcase_16 AC 204 ms
94,780 KB
testcase_17 AC 178 ms
90,636 KB
testcase_18 AC 101 ms
84,020 KB
testcase_19 AC 141 ms
92,672 KB
testcase_20 AC 124 ms
91,128 KB
testcase_21 AC 185 ms
92,552 KB
testcase_22 AC 258 ms
99,032 KB
testcase_23 AC 40 ms
55,612 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 37 ms
55,612 KB
testcase_27 AC 36 ms
55,612 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 37 ms
55,612 KB
testcase_31 AC 36 ms
55,612 KB
testcase_32 AC 36 ms
55,612 KB
testcase_33 AC 37 ms
55,612 KB
testcase_34 AC 37 ms
55,612 KB
testcase_35 AC 37 ms
55,612 KB
testcase_36 AC 37 ms
55,612 KB
testcase_37 AC 36 ms
55,612 KB
testcase_38 AC 37 ms
55,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
G = [[] for i in range(N)]
s, t, k = map(int, input().split())
s, t = s - 1, t - 1
for i in range(M):
    u, v = map(int, input().split())
    u, v = u - 1, v - 1
    G[u].append(v)
    G[v].append(u)
    
from collections import deque
def bfs(G, s):
    Q = deque([s])
    N = len(G)
    dist = [-1] * N
    par = [-1] * N
    dist[s] = 0
    while Q:
        u = Q.popleft()
        for v in G[u]:
            if dist[v] != -1:
                continue
            dist[v] = dist[u] + 1
            par[v] = u
            Q.append(v)

    return dist

D = bfs(G, s)
if D[t] == -1:
    print("Unknown")
elif (D[t] - k) % 2:
    print("No")
elif D[t] <= k:
    print("Yes")
else:
    print("Unknown")
0