結果

問題 No.1037 exhausted
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-04-24 23:55:17
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 460 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,684 KB
実行使用メモリ 77,248 KB
最終ジャッジ日時 2024-04-23 04:24:17
合計ジャッジ時間 3,116 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,008 KB
testcase_01 AC 40 ms
52,480 KB
testcase_02 AC 35 ms
53,336 KB
testcase_03 AC 35 ms
52,664 KB
testcase_04 AC 35 ms
52,888 KB
testcase_05 RE -
testcase_06 AC 34 ms
53,288 KB
testcase_07 AC 38 ms
52,824 KB
testcase_08 AC 36 ms
52,632 KB
testcase_09 AC 37 ms
53,420 KB
testcase_10 AC 37 ms
52,768 KB
testcase_11 AC 37 ms
52,284 KB
testcase_12 AC 114 ms
76,812 KB
testcase_13 AC 109 ms
76,592 KB
testcase_14 AC 112 ms
76,776 KB
testcase_15 AC 112 ms
76,764 KB
testcase_16 AC 114 ms
76,776 KB
testcase_17 AC 117 ms
76,500 KB
testcase_18 AC 117 ms
76,604 KB
testcase_19 AC 119 ms
76,536 KB
testcase_20 AC 126 ms
76,456 KB
testcase_21 AC 126 ms
76,392 KB
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, V, L = map(int, input().split())
inf = 10**18
dp = [inf]*(V+1)
dp[V] = 0
bx = 0
for _ in range(N):
    ndp = [inf] * (V+1)
    x, v, w = map(int, input().split())
    for vl in range(V+1):
        if vl+(x-bx) > V:
            continue
        ndp[vl] = dp[vl+(x-bx)]
    for vl in range(V, -1, -1):
        vi = min(vl+v, V)
        ndp[vi] = min(ndp[vi], ndp[vl]+w)
    dp = ndp
    bx = x
R = min(dp[L-bx:])
if R >= inf:
    print(-1)
else:
    print(R)
0