結果

問題 No.2674 k-Walk on Bipartite
ユーザー 👑 rin204rin204
提出日時 2024-03-15 21:35:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 97,612 KB
最終ジャッジ日時 2024-03-15 21:35:17
合計ジャッジ時間 7,517 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,476 KB
testcase_01 AC 39 ms
55,476 KB
testcase_02 AC 39 ms
55,476 KB
testcase_03 AC 43 ms
55,476 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 43 ms
55,476 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 208 ms
93,116 KB
testcase_10 WA -
testcase_11 AC 269 ms
89,516 KB
testcase_12 WA -
testcase_13 AC 189 ms
89,468 KB
testcase_14 WA -
testcase_15 AC 415 ms
95,608 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 143 ms
85,084 KB
testcase_19 AC 233 ms
91,524 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 433 ms
97,612 KB
testcase_23 AC 40 ms
55,604 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 41 ms
55,604 KB
testcase_27 AC 41 ms
55,604 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 40 ms
55,604 KB
testcase_31 AC 41 ms
55,604 KB
testcase_32 AC 41 ms
55,604 KB
testcase_33 AC 40 ms
55,604 KB
testcase_34 AC 40 ms
55,604 KB
testcase_35 AC 40 ms
55,604 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n, m = map(int, input().split())
s, t, k = map(int, input().split())
s -= 1
t -= 1
edges = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append(v)
    edges[v].append(u)

queue = deque()
queue.append(0)
dist = [-1] * n
dist[s] = 0
while queue:
    pos = queue.popleft()
    for npos in edges[pos]:
        if dist[npos] != -1:
            continue
        dist[npos] = dist[pos] + 1
        queue.append(npos)

if dist[t] == -1:
    print("Unknown")
elif dist[t] % 2 != k % 2:
    print("No")
elif dist[t] <= k:
    print("Yes")
else:
    print("Unknown")
0