Your dfs is incorrect. It does not search all possible paths

The correct thing to do is to unset visited[i][j] to false when you return 
from a path that does not give you any result.

在2021年4月8日星期四 UTC-7 下午12:41:12<metaxe...@gmail.com> 写道:

> Hello,
>
> My code passes 2 test sets but on the third one I get WA instead of TLE 
> which means my Depth-First-Search fails to backtrack properly. Can someone 
> help me fix it?
>
> Thanks in advance.
>
> https://pastebin.com/nWQi2WJG
>
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/28a5a7a5-b8fb-4be9-af00-b5d131cb6035n%40googlegroups.com.

Reply via email to