mayank0802's blog

By mayank0802, history, 5 years ago, In English
  • Vote: I like it
  • +15
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +10 Vote: I do not like it

I'm under the impression that whenever you decrement some value it's optimal to take it all the way down to 1. Therefore, you can go for a dynamic programming approach to solve the problem, where dp[i][flag] = largest possible answer for the i-th prefix and flag indicates if the last element stayed at his value or if he was reduced to 1.

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
code
  • »
    »
    5 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Nobody got an AC on this problem, was there some problem with it's test cases?

    solution
»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Congratulation for creating the 69420th blog of codeforces