turzo_sawroop's blog

By turzo_sawroop, history, 2 months ago, In English

https://codeforces.com/contest/578/problem/B

Can anyone help me find why my recursive dp is not working in case 22?

I am trying to find why my solution doesn't lead me to the expected answer.Actually I tried to maintain dp[pos][sum] which indicates maximum value till pos by making sum no of operations...my transition is if I make i<=k operations in a value in certain pos then I am checking whether sum+i is less than or equal to k, if it is then I am making the transition dp(pos+1,sum+i)

Hers's my submission:

123643862

UPD : I shuffled the vector 10 times and it got accepted

Accepted solution : https://codeforces.com/contest/578/submission/123648596

But dp wasn't the best approach here

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +1 Vote: I do not like it