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

Автор Six_Seconds, история, 16 месяцев назад, По-английски

I have tried different times in different ways to execute an accepted solution but Alas, everytime I failed. I would be eternally grateful if someone could debug my code and say what and where I should change in my code so that I won't get TLE. Here is my code Geting TLE in 1000 x 1000 grids Thanks a lot in advance.

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

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

Have you thought about what the time complexity is of your approach? I see you are running a lot of BFS's in a loop. Ok, that seems to be alright, because there's only one character in the grid that's A. Another concern is the many maps you are using for storing info. They give an extra log factor, with quite a big constant. Try changing them to arrays.

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

Thanks, I got stuck on the same.

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

    So Happy to know that, This blog is still helpful. Some months ago, I thought of deleting this blog. Glad that, I didn't delete the blog.