結果

問題 No.2387 Yokan Factory
ユーザー ryohei22ryohei22
提出日時 2023-07-21 21:44:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,612 KB
実行使用メモリ 53,476 KB
最終ジャッジ日時 2023-10-21 21:43:31
合計ジャッジ時間 7,846 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,476 KB
testcase_01 AC 38 ms
53,348 KB
testcase_02 AC 38 ms
53,348 KB
testcase_03 WA -
testcase_04 AC 38 ms
53,348 KB
testcase_05 AC 38 ms
53,348 KB
testcase_06 AC 38 ms
53,348 KB
testcase_07 AC 38 ms
53,348 KB
testcase_08 WA -
testcase_09 AC 38 ms
53,348 KB
testcase_10 AC 38 ms
53,348 KB
testcase_11 AC 39 ms
53,348 KB
testcase_12 AC 38 ms
53,348 KB
testcase_13 AC 39 ms
53,348 KB
testcase_14 AC 38 ms
53,348 KB
testcase_15 TLE -
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 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def BFS():
    q = [(0, 0)]
    wid = [-1] * N
    wid[0] = float('inf')
    while q:
        new = []
        for i, t in q:
            for j, a, b in e[i]:
                if wid[j] < min(wid[i], b) and t + a <= X:
                    new.append((j, t+a))
                    wid[j] = min(wid[i], b)
        q = new

    return wid


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

wid = BFS()
print(wid[-1])
0