結果

問題 No.1607 Kth Maximum Card
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-07-17 10:41:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,645 ms / 3,500 ms
コード長 653 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 191,004 KB
最終ジャッジ日時 2023-09-21 03:38:45
合計ジャッジ時間 31,007 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,620 KB
testcase_01 AC 90 ms
71,724 KB
testcase_02 AC 91 ms
71,700 KB
testcase_03 AC 93 ms
71,696 KB
testcase_04 AC 94 ms
71,332 KB
testcase_05 AC 95 ms
71,704 KB
testcase_06 AC 93 ms
71,776 KB
testcase_07 AC 94 ms
71,712 KB
testcase_08 AC 1,758 ms
150,812 KB
testcase_09 AC 2,135 ms
165,224 KB
testcase_10 AC 2,645 ms
191,004 KB
testcase_11 AC 577 ms
92,644 KB
testcase_12 AC 2,036 ms
163,152 KB
testcase_13 AC 327 ms
84,956 KB
testcase_14 AC 369 ms
87,916 KB
testcase_15 AC 1,190 ms
123,600 KB
testcase_16 AC 310 ms
85,464 KB
testcase_17 AC 216 ms
80,364 KB
testcase_18 AC 824 ms
107,084 KB
testcase_19 AC 523 ms
94,688 KB
testcase_20 AC 711 ms
100,388 KB
testcase_21 AC 750 ms
102,920 KB
testcase_22 AC 1,378 ms
138,348 KB
testcase_23 AC 1,478 ms
138,808 KB
testcase_24 AC 742 ms
95,848 KB
testcase_25 AC 411 ms
87,168 KB
testcase_26 AC 616 ms
90,560 KB
testcase_27 AC 878 ms
96,948 KB
testcase_28 AC 715 ms
92,380 KB
testcase_29 AC 1,344 ms
119,400 KB
testcase_30 AC 1,957 ms
131,532 KB
testcase_31 AC 1,282 ms
115,368 KB
testcase_32 AC 419 ms
102,880 KB
testcase_33 AC 426 ms
102,968 KB
testcase_34 AC 506 ms
103,560 KB
testcase_35 AC 418 ms
103,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m,k = map(int,input().split())
e = [[] for i in range(n)]
for _ in range(m):
    u,v,c = map(int,input().split())
    e[u-1].append((v-1,c))
    e[v-1].append((u-1,c))
def search(x):
    dis = [k+1]*n
    dis[0] = 0
    q = deque([[0,0]])
    while q:
        now,cost = q.popleft()
        for nex,c in e[now]:
            d = int(c > x)
            if dis[nex] > cost + d:
                dis[nex] = cost+d
                q.append([nex,cost+d]) if d else q.appendleft([nex,cost])
    return dis[-1] < k
l,r = -1,2*10**5
while r > l + 1:
    m = (r+l)//2
    if search(m):
        r = m
    else:
        l = m
print(r)
0