結果

問題 No.2387 Yokan Factory
ユーザー minimumminimum
提出日時 2023-07-21 22:47:45
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 981 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,484 KB
実行使用メモリ 119,524 KB
最終ジャッジ日時 2023-10-21 22:51:33
合計ジャッジ時間 9,919 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,264 KB
testcase_01 AC 36 ms
53,264 KB
testcase_02 AC 36 ms
53,264 KB
testcase_03 AC 35 ms
53,264 KB
testcase_04 AC 39 ms
53,264 KB
testcase_05 AC 34 ms
53,264 KB
testcase_06 AC 38 ms
53,264 KB
testcase_07 AC 38 ms
53,264 KB
testcase_08 AC 37 ms
53,264 KB
testcase_09 AC 41 ms
53,264 KB
testcase_10 AC 36 ms
53,264 KB
testcase_11 AC 35 ms
53,264 KB
testcase_12 AC 35 ms
53,264 KB
testcase_13 AC 36 ms
53,264 KB
testcase_14 AC 35 ms
53,264 KB
testcase_15 AC 1,063 ms
118,148 KB
testcase_16 AC 496 ms
117,824 KB
testcase_17 TLE -
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 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush


INF = 10 ** 18
N, M, X = map(int, input().split())
edges = [[] for i in range(N)]
edges_a = [[] for i in range(N)]
edges_b = [[] for i in range(N)]

for i in range(M):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append(v)
    edges_a[u].append(a)
    edges_b[u].append(b)
    edges[v].append(u)
    edges_a[v].append(a)
    edges_b[v].append(b)


ok = -1
ng = INF

while ng - ok > 1:
    m = (ng + ok) // 2
    dist = [INF] * N
    hq = []
    heappush(hq, (0, 0))
    dist[0] = 0
    while hq:
        _, now = heappop(hq)
        for i in range(len(edges[now])):
            nxt = edges[now][i]
            a = edges_a[now][i]
            b = edges_b[now][i]
            if b < m:
                continue
            if dist[nxt] > dist[now] + a:
                dist[nxt] = dist[now] + a
                heappush(hq, (dist[nxt], nxt))
    if dist[-1] > X:
        ng = m
    else:
        ok = m
print(ok)
0