Help in dp problem

Revision en1, by electro177, 2021-06-15 14:51:21

I was doing problem towers.I sorted all the blocks according to weight + strength from exchange arguments and then now i did not get idea how to do transitions in dp ,but i saw some code and i thought i should do it by weights from 0 to total weight (but i do not know why) and the transition was ~~~~~ for (auto block : blocks) { for (int i = w + s; i >= w; i--) { dp[i] = max(dp[i], dp[i — w] + v); ~~~~~

Please help me how to take the dp state and also the transitions mainly(i did not understand after thinking a lot) Thank you

Tags # dp, #confused, subtask


  Rev. Lang. By When Δ Comment
en2 English electro177 2021-06-15 14:53:27 94
en1 English electro177 2021-06-15 14:51:21 616 Initial revision (published)