結果

問題 No.2387 Yokan Factory
ユーザー Akijin_007Akijin_007
提出日時 2023-07-21 22:13:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 828 bytes
コンパイル時間 963 ms
コンパイル使用メモリ 81,768 KB
実行使用メモリ 174,776 KB
最終ジャッジ日時 2023-10-21 22:13:39
合計ジャッジ時間 26,300 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,488 KB
testcase_01 AC 39 ms
53,488 KB
testcase_02 AC 40 ms
53,488 KB
testcase_03 AC 40 ms
53,488 KB
testcase_04 AC 40 ms
53,488 KB
testcase_05 AC 39 ms
53,488 KB
testcase_06 WA -
testcase_07 AC 40 ms
53,488 KB
testcase_08 AC 40 ms
53,488 KB
testcase_09 AC 40 ms
53,488 KB
testcase_10 AC 39 ms
53,488 KB
testcase_11 AC 40 ms
53,488 KB
testcase_12 AC 40 ms
53,488 KB
testcase_13 AC 41 ms
53,488 KB
testcase_14 AC 40 ms
53,488 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1,722 ms
174,776 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 861 ms
93,728 KB
testcase_26 AC 1,234 ms
112,432 KB
testcase_27 AC 656 ms
106,116 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 133 ms
77,940 KB
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

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

import heapq

min1 = -1
max1 = 10 ** 9 + 10

while max1 - min1 > 1:
    h = (max1 + min1) // 2
    v = [X+1] * N
    q = [(0, 0)]
    heapq.heapify(q)
    while q:
        t, x = heapq.heappop(q)
        if v[x] < t:
            continue

        for y, a, b in to[x]:
            if h > b:
                continue
            if v[y] < t+a or t+a > X:
                continue
            heapq.heappush(q, (t+a, y))
            v[y] = t+a

    if max(v) == X+1:
        max1 = h
    else:
        min1 = h

if min1 == -1:
    print(-1)
else:
    print(min1)

0