Блог пользователя mayank0802

Автор mayank0802, история, 5 лет назад, По-английски
  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

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 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
code
  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

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

    solution
»
4 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

Congratulation for creating the 69420th blog of codeforces