I was trying to figure out why there is a difference in verdict in these two solutions for 1354F - Summoning Minions (summoning minions):
Solution that gives WA on test case 32 of test 2: https://pastebin.com/EzbSDw3Z
AC Solution: https://pastebin.com/DjFkheFs
The only difference between these two solutions is that when deciding whether to include one of the minions, in WA solution, I try to find max(dp[i-1][j]+minion[i].b*(k-1), dp[i-1][j-1]+minion[i].a+minion[i].b*(j-1)), which should give the actual value of the dp at that state.
On the other hand, the AC solution finds max(dp[i-1][j], dp[i-1][j-1]+minion[i].a-minion[i].b*(k-j)). I expected both methods to produce the same result, and tried to find an instance where the methods would produce different results, but I could not.
Can anyone explain why the first method causes WA?