結果

問題 No.2387 Yokan Factory
ユーザー Akijin_007Akijin_007
提出日時 2023-07-21 22:22:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 868 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 81,632 KB
実行使用メモリ 176,204 KB
最終ジャッジ日時 2023-10-21 22:23:10
合計ジャッジ時間 20,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,272 KB
testcase_01 AC 35 ms
53,272 KB
testcase_02 AC 38 ms
53,272 KB
testcase_03 AC 38 ms
53,272 KB
testcase_04 AC 35 ms
53,272 KB
testcase_05 AC 39 ms
53,272 KB
testcase_06 WA -
testcase_07 AC 35 ms
53,272 KB
testcase_08 AC 36 ms
53,272 KB
testcase_09 AC 37 ms
53,272 KB
testcase_10 AC 36 ms
53,272 KB
testcase_11 AC 35 ms
53,272 KB
testcase_12 AC 35 ms
53,272 KB
testcase_13 AC 34 ms
53,272 KB
testcase_14 AC 35 ms
53,272 KB
testcase_15 AC 810 ms
118,144 KB
testcase_16 AC 571 ms
123,112 KB
testcase_17 AC 1,405 ms
176,204 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 630 ms
93,324 KB
testcase_26 AC 949 ms
107,344 KB
testcase_27 AC 473 ms
105,752 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 118 ms
77,204 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 = 0
max1 = 10 ** 9 + 10

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

        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] = min(v[y], t+a)

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

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

0