結果

問題 No.1607 Kth Maximum Card
ユーザー titiatitia
提出日時 2021-07-24 05:54:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,740 ms / 3,500 ms
コード長 750 bytes
コンパイル時間 923 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 129,060 KB
最終ジャッジ日時 2023-09-26 11:33:42
合計ジャッジ時間 32,675 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,516 KB
testcase_01 AC 92 ms
71,236 KB
testcase_02 AC 92 ms
71,328 KB
testcase_03 AC 91 ms
71,252 KB
testcase_04 AC 91 ms
71,328 KB
testcase_05 AC 93 ms
71,284 KB
testcase_06 AC 91 ms
71,236 KB
testcase_07 AC 90 ms
71,468 KB
testcase_08 AC 2,149 ms
126,436 KB
testcase_09 AC 2,191 ms
118,128 KB
testcase_10 AC 2,103 ms
129,060 KB
testcase_11 AC 536 ms
89,924 KB
testcase_12 AC 2,091 ms
117,284 KB
testcase_13 AC 346 ms
85,792 KB
testcase_14 AC 446 ms
88,396 KB
testcase_15 AC 1,411 ms
112,208 KB
testcase_16 AC 302 ms
86,120 KB
testcase_17 AC 187 ms
79,888 KB
testcase_18 AC 894 ms
100,384 KB
testcase_19 AC 561 ms
93,060 KB
testcase_20 AC 715 ms
95,864 KB
testcase_21 AC 760 ms
97,836 KB
testcase_22 AC 1,324 ms
123,648 KB
testcase_23 AC 1,438 ms
123,616 KB
testcase_24 AC 867 ms
93,984 KB
testcase_25 AC 503 ms
88,808 KB
testcase_26 AC 606 ms
90,628 KB
testcase_27 AC 871 ms
94,436 KB
testcase_28 AC 721 ms
92,104 KB
testcase_29 AC 1,533 ms
104,740 KB
testcase_30 AC 2,740 ms
124,728 KB
testcase_31 AC 1,425 ms
103,576 KB
testcase_32 AC 428 ms
99,644 KB
testcase_33 AC 430 ms
99,320 KB
testcase_34 AC 418 ms
99,544 KB
testcase_35 AC 429 ms
99,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import deque

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=deque([0])
    ANS=[1<<30]*N
    ANS[0]=0

    while Q:
        x=Q.popleft()
        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.appendleft(to)

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

print(NG)
                
0