結果

問題 No.1607 Kth Maximum Card
ユーザー 👑 KazunKazun
提出日時 2021-07-16 22:50:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 133,512 KB
最終ジャッジ日時 2023-09-20 15:15:01
合計ジャッジ時間 16,140 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,508 KB
testcase_01 AC 91 ms
71,716 KB
testcase_02 AC 90 ms
71,496 KB
testcase_03 WA -
testcase_04 AC 90 ms
71,608 KB
testcase_05 AC 90 ms
71,388 KB
testcase_06 WA -
testcase_07 AC 91 ms
71,740 KB
testcase_08 WA -
testcase_09 AC 614 ms
120,040 KB
testcase_10 AC 780 ms
133,104 KB
testcase_11 AC 245 ms
88,444 KB
testcase_12 AC 587 ms
119,156 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 217 ms
86,508 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 461 ms
108,452 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def bfs(x):
    Q=deque([x])
    X=[-1]*(N+1); X[x]=0
    while Q:
        x=Q.popleft()
        for y in F[x]:
            if X[y]==-1:
                X[y]=X[x]+1
                Q.append(y)
    return X

import sys
from collections import deque
N,M,K=map(int,input().split())
E=[]
F=[[] for _ in range(N+1)]
for _ in range(M):
    u,v,c=map(int,input().split())
    E.append((u,v,c))
    F[u].append(v)
    F[v].append(u)

E.append((1,1,0))
F[1].append(1)

Y=bfs(N)

E.sort(key=lambda t:t[2])
for u,v,c in E:
    if min(Y[u],Y[v])<K:
        exit(print(c))
0