結果

問題 No.1037 exhausted
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-04-24 23:08:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 77,012 KB
最終ジャッジ日時 2024-04-23 04:10:55
合計ジャッジ時間 2,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,576 KB
testcase_01 AC 35 ms
52,424 KB
testcase_02 AC 34 ms
53,980 KB
testcase_03 AC 35 ms
52,208 KB
testcase_04 WA -
testcase_05 AC 33 ms
52,444 KB
testcase_06 AC 33 ms
53,496 KB
testcase_07 WA -
testcase_08 AC 36 ms
52,276 KB
testcase_09 WA -
testcase_10 AC 36 ms
53,156 KB
testcase_11 WA -
testcase_12 AC 107 ms
76,384 KB
testcase_13 AC 100 ms
76,252 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 101 ms
76,528 KB
testcase_19 WA -
testcase_20 AC 113 ms
76,424 KB
testcase_21 AC 115 ms
76,200 KB
testcase_22 AC 96 ms
76,072 KB
権限があれば一括ダウンロードができます

ソースコード

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):
        if vl-v < 0:
            continue
        ndp[vl] = min(ndp[vl], ndp[vl-v]+w)
    dp = ndp
    bx = x
R = inf
for i in range(L-bx, V+1):
    R = min(R, dp[i])
if R == inf:
    print(-1)
else:
    print(R)
0