# Help in Maintenance Planning (https://training.olinfo.it/#/task/ois\_machine/statement)

**URL:** <https://forum.olinfo.it/t/help-in-maintenance-planning-https-training-olinfo-it-task-ois-machine-statement/7971>\
**Category:** Aiuto\
**Created:** [5 Gennaio 2023, 6:52pm UTC](https://forum.olinfo.it/t/help-in-maintenance-planning-https-training-olinfo-it-task-ois-machine-statement/7971 "2023-01-05T18:52:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eusebiuu](https://forum.olinfo.it/letter_avatar_proxy/v4/letter/e/9fc348/32.png) [@eusebiuu](https://forum.olinfo.it/u/eusebiuu)\
**Post date:** [5 Gennaio 2023, 6:52pm UTC](https://forum.olinfo.it/t/help-in-maintenance-planning-https-training-olinfo-it-task-ois-machine-statement/7971/1 "2023-01-05T18:52:10Z")

</div>

Hi! I recently tried to solve Maintenance Planning problem, but I cannot figure out how to resolve the last subtask. Basically, my solution is a dp[i] that represents the minimum price that I have to spend in order to have the machine sold in year i. My reccurence relation is dp[i] = min(dp[i - j] + C + m1 + m2 + … + mj - pj) where j is from [1, d]. The problem is that I will get TLE for last subtask, obviously, and I cannot figure out how to approach it. Thus, I will be grateful if you can guide me with some hints 😃  
P.S.: I figured out that “C + m1 + … + mj - pj” is a constant but I cannot see how to use it
