Timeout while using DFS

Revision en1, by sorablaze_11, 2017-12-20 18:33:47

I am solving this problem. And here is the solution. I am using only a simple dfs but it is showing timeout. I am not able to understand why, as time complexity of dfs is O(V + E) and my solution is well within the limits. Can someone help me? Please.

Tags dfs, timeout, cf358 div2c

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English sorablaze_11 2017-12-20 18:33:47 378 Initial revision (published)