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

Автор BanazadehAria, история, 5 лет назад, По-английски

Hi, I have written this code and i am using dp for problem 553 A.What is wrong with my idea and code?

Question Link==>https://codeforces.com/contest/553/problem/A

My Submission==>55667272

  • Проголосовать: нравится
  • -4
  • Проголосовать: не нравится

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

Auto comment: topic has been updated by BanazadehAria (previous revision, new revision, compare).

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

Try printing the dp table and inspecting the values. You should be able to deduce why your logic is wrong from there.

  • »
    »
    5 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Thank you ,I think its a code problem.

    What is wrong with it? ==> 1-If this new ball is from a new color then we must put it at last of the line Because it's the only and of course last element of new color. dp[i-1][j-1] 2-If it's not then we can put it anywhere else dp[i-1][j]*i