結果
問題 | No.1037 exhausted |
ユーザー |
![]() |
提出日時 | 2020-08-03 00:27:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 849 bytes |
コンパイル時間 | 329 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 142,336 KB |
最終ジャッジ日時 | 2024-07-20 01:10:59 |
合計ジャッジ時間 | 6,279 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 6 |
ソースコード
import sys; input = sys.stdin.buffer.readlinesys.setrecursionlimit(10**7)from collections import defaultdictcon = 10 ** 9 + 7; INF = float("inf")def getlist():return list(map(int, input().split()))#処理内容def main():N, V, L = getlist()DP = [[INF] * (V + 1) for i in range(N + 2)]DP[0][V] = 0xnow = 0for i in range(1, N + 1):x, v, w = getlist()for j in range(V + 1):if j + (x - xnow) <= V:DP[i][j] = min(DP[i][j], DP[i - 1][j + (x - xnow)])DP[i][min(V, j + v)] = min(DP[i][min(V, j + v)], DP[i][j] + w)# if j >= v:# DP[i][j] = min(DP[i][j], DP[i][j - v] + w)xnow = xfor j in range(V + 1):if j + (L - xnow) <= V:DP[N + 1][j] = min(DP[N + 1][j], DP[N][j + (L - xnow)])# print(DP)ans = min(DP[-1])if ans == INF:print(-1)else:print(ans)if __name__ == '__main__':main()