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

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

In today's kickstart problem, https://codejam.withgoogle.com/codejam/contest/6304486/dashboard#s=p1

I am getting wrong answer on big input but smaller input works fine and gives correct answer. Here is my code: https://ideone.com/7Ffer4

I tried with bigger input and answer is coming mostly as 0.

I can't find the error. Can someone tell the error and how to correct it.

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

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

I think it will lead to overflow in dp array.

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

    No I checked with

    N = 2000

    M = 1999

    There was no overflow in dp though answer was very large in 10^18.

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

      there is overflow.If u are not convinced try running a loop over the dp array and check if anything is less than zero for testcase N=2000,M=1999


      Answer to the question