結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,776 KB
testcase_01 AC 98 ms
71,664 KB
testcase_02 AC 95 ms
71,772 KB
testcase_03 AC 95 ms
71,776 KB
testcase_04 AC 92 ms
71,584 KB
testcase_05 AC 94 ms
71,772 KB
testcase_06 AC 95 ms
71,328 KB
testcase_07 AC 95 ms
71,788 KB
testcase_08 AC 1,818 ms
150,624 KB
testcase_09 AC 2,170 ms
165,024 KB
testcase_10 AC 2,731 ms
191,348 KB
testcase_11 AC 607 ms
92,952 KB
testcase_12 AC 2,107 ms
163,144 KB
testcase_13 AC 333 ms
85,072 KB
testcase_14 AC 381 ms
88,104 KB
testcase_15 AC 1,246 ms
123,652 KB
testcase_16 AC 321 ms
85,552 KB
testcase_17 AC 219 ms
80,296 KB
testcase_18 AC 828 ms
107,152 KB
testcase_19 AC 506 ms
94,840 KB
testcase_20 AC 718 ms
100,276 KB
testcase_21 AC 727 ms
103,032 KB
testcase_22 AC 1,376 ms
138,648 KB
testcase_23 AC 1,412 ms
138,724 KB
testcase_24 AC 754 ms
96,048 KB
testcase_25 AC 445 ms
87,524 KB
testcase_26 AC 593 ms
90,576 KB
testcase_27 AC 837 ms
96,796 KB
testcase_28 AC 712 ms
92,500 KB
testcase_29 AC 1,373 ms
119,552 KB
testcase_30 AC 2,003 ms
131,676 KB
testcase_31 AC 1,349 ms
115,424 KB
testcase_32 AC 442 ms
102,768 KB
testcase_33 AC 451 ms
102,848 KB
testcase_34 AC 523 ms
103,288 KB
testcase_35 AC 430 ms
102,840 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
                if d:
                    q.append([nex,cost+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