結果

問題 No.1607 Kth Maximum Card
ユーザー titiatitia
提出日時 2021-07-24 05:52:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 705 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 155,944 KB
最終ジャッジ日時 2023-09-26 11:29:31
合計ジャッジ時間 18,502 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
155,944 KB
testcase_01 AC 72 ms
71,296 KB
testcase_02 AC 73 ms
71,292 KB
testcase_03 AC 72 ms
71,204 KB
testcase_04 AC 73 ms
71,232 KB
testcase_05 AC 72 ms
71,204 KB
testcase_06 AC 73 ms
71,292 KB
testcase_07 AC 72 ms
71,492 KB
testcase_08 AC 2,628 ms
122,564 KB
testcase_09 AC 1,849 ms
114,132 KB
testcase_10 AC 2,162 ms
124,060 KB
testcase_11 AC 410 ms
91,688 KB
testcase_12 AC 1,674 ms
113,908 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M,K=map(int,input().split())
E=[[] for i in range(N)]

for i in range(M):
    u,v,c=map(int,input().split())
    u-=1
    v-=1

    E[u].append((v,c))
    E[v].append((u,c))

OK=10**6
NG=0

while OK>NG+1:
    mid=(OK+NG)//2

    Q=[0]
    ANS=[1<<30]*N
    ANS[0]=0

    while Q:
        x=Q.pop()
        for to,c in E[x]:
            if c>=mid:
                if ANS[to]>ANS[x]+1:
                    ANS[to]=ANS[x]+1
                    Q.append(to)
            else:
                if ANS[to]>ANS[x]:
                    ANS[to]=ANS[x]
                    Q.append(to)

    if ANS[N-1]>=K:
        NG=mid
    else:
        OK=mid

print(NG)
                
0