結果

問題 No.1037 exhausted
ユーザー stngstng
提出日時 2022-08-31 20:53:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 634 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 82,960 KB
実行使用メモリ 94,932 KB
最終ジャッジ日時 2024-04-26 03:16:23
合計ジャッジ時間 6,008 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
57,600 KB
testcase_01 AC 38 ms
52,224 KB
testcase_02 WA -
testcase_03 AC 37 ms
52,352 KB
testcase_04 AC 38 ms
52,736 KB
testcase_05 AC 43 ms
59,008 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 39 ms
51,840 KB
testcase_09 WA -
testcase_10 AC 39 ms
52,352 KB
testcase_11 WA -
testcase_12 AC 124 ms
77,080 KB
testcase_13 AC 134 ms
76,928 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 155 ms
76,928 KB
testcase_17 AC 153 ms
77,156 KB
testcase_18 AC 134 ms
76,672 KB
testcase_19 WA -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,v,l = map(int,input().split())
xvw = [[int(i) for i in input().split()] for j in range(n)]

dp = [10**15]*(l+1)
dp[v] = 0
pos = 0

for i in range(n):
    x,vi,wi = xvw[i]
    dis = x-pos
    for j in range(l+1):
        if dis > j:
            dp[j] = 10**15
        else:
            dp[j-dis] = dp[j]
    #print(dis)
    for j in range(l+1):
        dp[min(v,j+vi)] = min(dp[j]+wi,dp[min(v,j+vi)])
    pos = x
    #print(dp,i)

if pos != l:
    dis = l-pos
    ans = 10**15
    for j in range(l+1):
        if dis <= j:
            ans = min(ans,dp[j])
else:
    ans = min(dp)

if ans >= 10**15:
    print(-1)
else:
    print(ans)
0