結果

問題 No.1037 exhausted
ユーザー Kiri8128Kiri8128
提出日時 2020-04-24 22:16:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 284,856 KB
最終ジャッジ日時 2024-04-23 03:28:31
合計ジャッジ時間 4,311 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
60,240 KB
testcase_01 AC 38 ms
53,504 KB
testcase_02 WA -
testcase_03 AC 37 ms
52,952 KB
testcase_04 WA -
testcase_05 AC 37 ms
52,576 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 40 ms
52,244 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(S, v, w):
    T = sorted(S[:] + [(min(s[0] + v, V), s[1] + w) for s in S], key = lambda x: -x[0])
    U = []
    pre = 1 << 100
    for t in T:
        if t[1] < pre:
            U.append(t)
            pre = t[1]
    return U

N, V, L = map(int, input().split())
S = [(V, 0)]
prex = 0
for _ in range(N):
    x, v, w = map(int, input().split())
    dx = x - prex
    prex = x
    S = [(v - dx, w) for v, w in S if v >= dx]
    S = calc(S, v, w)

dx = L - prex
print(min([w for v, w in S if v >= dx] + [-1]))
0