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

Автор ChairMan, история, 3 года назад, По-английски

Hi, so i've been trying to solve this problems with dfs, but it still gives me TLE and RE. Could someone please tell me what's wrong with my code ? My code

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

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

If the problem is TLE, maybe you can try to use reference with your grid, or make it a global variable, else it would copy the whole gird every time you call the dfs function.

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

Yah seems like you are not passing the grid by reference.

A neater implementation trick: https://pastebin.com/9Ji9fMi3