結果

問題 No.1607 Kth Maximum Card
ユーザー ああいいああいい
提出日時 2022-03-07 11:18:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 778 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 197,752 KB
最終ジャッジ日時 2023-09-29 10:13:54
合計ジャッジ時間 8,570 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
75,980 KB
testcase_01 AC 80 ms
71,516 KB
testcase_02 AC 78 ms
71,344 KB
testcase_03 AC 80 ms
71,120 KB
testcase_04 AC 78 ms
71,124 KB
testcase_05 AC 77 ms
71,276 KB
testcase_06 AC 78 ms
71,336 KB
testcase_07 AC 76 ms
71,236 KB
testcase_08 TLE -
testcase_09 AC 2,528 ms
163,936 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
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 #

N,M,K = map(int,input().split())
G = [[] for _ in range(N+1)]
for _ in range(M):
    a,b,c = map(int,input().split())
    G[a].append((b,c))
    G[b].append((a,c))

import heapq
inf = 10 ** 6
def calc(x):
    dist = [inf] * (N+1)
    dist[1] = 0
    q = [(0,1)]
    while q:
        d,now = heapq.heappop(q)
        if now == N:break
        if dist[now] < d:
            continue
        for v,c in G[now]:
            if c > x:
                c = 1
            else:
                c = 0
            if dist[v] > d + c:
                dist[v] = d + c
                heapq.heappush(q,(d+c,v))
    return dist[N] < K
start = -1
end = 2 * 10 ** 5
while end - start > 1:
    mid = (end + start) // 2
    if calc(mid):
        end = mid
    else:
       start = mid
print(end)
0