結果

問題 No.1607 Kth Maximum Card
ユーザー ああいいああいい
提出日時 2022-03-07 11:22:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 848 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 149,296 KB
最終ジャッジ日時 2023-09-29 10:17:17
合計ジャッジ時間 37,163 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,576 KB
testcase_01 AC 71 ms
71,324 KB
testcase_02 AC 73 ms
71,300 KB
testcase_03 AC 72 ms
71,356 KB
testcase_04 AC 72 ms
71,108 KB
testcase_05 AC 76 ms
71,476 KB
testcase_06 AC 75 ms
71,484 KB
testcase_07 AC 73 ms
71,440 KB
testcase_08 AC 3,009 ms
143,948 KB
testcase_09 AC 1,602 ms
134,040 KB
testcase_10 AC 3,222 ms
149,296 KB
testcase_11 AC 435 ms
94,052 KB
testcase_12 AC 2,060 ms
129,316 KB
testcase_13 AC 551 ms
89,216 KB
testcase_14 AC 529 ms
90,988 KB
testcase_15 AC 2,021 ms
124,480 KB
testcase_16 AC 440 ms
88,300 KB
testcase_17 AC 414 ms
83,212 KB
testcase_18 AC 1,166 ms
108,884 KB
testcase_19 AC 900 ms
99,252 KB
testcase_20 AC 1,254 ms
103,376 KB
testcase_21 AC 1,149 ms
104,048 KB
testcase_22 AC 900 ms
134,136 KB
testcase_23 AC 1,026 ms
135,616 KB
testcase_24 AC 869 ms
99,532 KB
testcase_25 AC 668 ms
91,636 KB
testcase_26 AC 701 ms
95,276 KB
testcase_27 AC 950 ms
100,456 KB
testcase_28 AC 856 ms
98,136 KB
testcase_29 AC 1,647 ms
113,480 KB
testcase_30 TLE -
testcase_31 AC 1,829 ms
112,012 KB
testcase_32 AC 397 ms
102,092 KB
testcase_33 AC 403 ms
102,140 KB
testcase_34 AC 407 ms
102,152 KB
testcase_35 AC 395 ms
102,596 KB
権限があれば一括ダウンロードができます

ソースコード

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
base = 23
mask = (1 << base) - 1
def calc(x):
    dist = [inf] * (N+1)
    dist[1] = 0
    q = [1]
    while q:
        u = heapq.heappop(q)
        d,now = u >> base,u & mask
        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) << base | 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