結果

問題 No.1037 exhausted
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-04-24 23:13:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 486 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2024-04-23 04:13:43
合計ジャッジ時間 2,788 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 38 ms
52,352 KB
testcase_03 AC 39 ms
51,840 KB
testcase_04 AC 39 ms
52,096 KB
testcase_05 AC 39 ms
52,096 KB
testcase_06 AC 38 ms
51,840 KB
testcase_07 WA -
testcase_08 AC 39 ms
52,352 KB
testcase_09 WA -
testcase_10 AC 39 ms
52,096 KB
testcase_11 WA -
testcase_12 AC 122 ms
76,288 KB
testcase_13 AC 113 ms
76,544 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 125 ms
77,056 KB
testcase_17 AC 123 ms
76,544 KB
testcase_18 AC 117 ms
76,160 KB
testcase_19 WA -
testcase_20 AC 123 ms
76,564 KB
testcase_21 AC 127 ms
76,564 KB
testcase_22 AC 103 ms
76,288 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):
        ndp[min(vl+v, V)] = min(ndp[min(vl+v, V)], ndp[vl]+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