結果

問題 No.2674 k-Walk on Bipartite
ユーザー nikoro256nikoro256
提出日時 2024-03-19 15:38:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 99,280 KB
最終ジャッジ日時 2024-03-19 15:38:09
合計ジャッジ時間 8,028 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,608 KB
testcase_01 AC 41 ms
55,608 KB
testcase_02 AC 40 ms
55,608 KB
testcase_03 AC 40 ms
55,608 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 40 ms
55,608 KB
testcase_07 AC 279 ms
92,948 KB
testcase_08 AC 325 ms
92,508 KB
testcase_09 AC 206 ms
93,120 KB
testcase_10 AC 373 ms
95,996 KB
testcase_11 AC 260 ms
90,672 KB
testcase_12 AC 365 ms
93,316 KB
testcase_13 AC 182 ms
89,464 KB
testcase_14 AC 100 ms
83,216 KB
testcase_15 AC 405 ms
97,264 KB
testcase_16 AC 280 ms
94,644 KB
testcase_17 AC 329 ms
90,420 KB
testcase_18 AC 141 ms
85,088 KB
testcase_19 AC 221 ms
91,528 KB
testcase_20 AC 206 ms
92,408 KB
testcase_21 AC 300 ms
93,348 KB
testcase_22 AC 438 ms
99,280 KB
testcase_23 AC 40 ms
55,608 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 41 ms
55,608 KB
testcase_27 AC 41 ms
55,608 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 40 ms
55,608 KB
testcase_31 AC 40 ms
55,608 KB
testcase_32 AC 40 ms
55,608 KB
testcase_33 AC 40 ms
55,608 KB
testcase_34 AC 40 ms
55,608 KB
testcase_35 WA -
testcase_36 AC 41 ms
55,608 KB
testcase_37 AC 40 ms
55,608 KB
testcase_38 AC 40 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def bfs(s):
    dq=deque()
    dq.append([s,0])
    high=[10**9 for _ in range(N)]
    high[s]=0
    while len(dq)!=0:
        p,h=dq.popleft()
        for e in edge[p]:
            if  high[e]==10**9:
                dq.append([e,h+1])
                high[e]=h+1
    return high

N,M=map(int,input().split())
s,t,k=map(int,input().split())
s-=1
t-=1
edge=[[] for _ in range(N)]
for _ in range(M):
    a,b=map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
dist=bfs(s)
if dist[t]==10**9:
    print('Unknown')
elif dist[t]%2!=k%2:
    print('No')
elif dist[t]<k:
    print('Yes')
else:
    print('Unknown')
0