ChairMan's blog

By ChairMan, history, 3 years ago, In English

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

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