結果
| 問題 |
No.2674 k-Walk on Bipartite
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-03-16 06:37:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 577 bytes |
| コンパイル時間 | 112 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 41,984 KB |
| 最終ジャッジ日時 | 2024-09-30 03:52:18 |
| 合計ジャッジ時間 | 12,619 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 12 |
ソースコード
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")
Today03