結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 40 ms
52,352 KB
testcase_02 AC 40 ms
51,840 KB
testcase_03 AC 39 ms
52,096 KB
testcase_04 AC 41 ms
52,480 KB
testcase_05 AC 38 ms
51,840 KB
testcase_06 AC 38 ms
52,096 KB
testcase_07 WA -
testcase_08 AC 39 ms
52,352 KB
testcase_09 WA -
testcase_10 AC 38 ms
51,968 KB
testcase_11 WA -
testcase_12 AC 120 ms
76,416 KB
testcase_13 AC 114 ms
76,288 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 123 ms
77,312 KB
testcase_17 AC 123 ms
77,056 KB
testcase_18 AC 119 ms
76,416 KB
testcase_19 WA -
testcase_20 AC 124 ms
76,452 KB
testcase_21 AC 128 ms
76,292 KB
testcase_22 AC 107 ms
76,672 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