Why giving TLE?

Revision en1, by ahmadexe, 2024-06-28 19:40:12

So I am a newbie in DFS and BFS, and was solving this problem. Surprisingly, giving TLE in 3rd testcase. I can't seem to understand where code is inefficient since time complexity is looking fine to me I have added some comments, which don't use the ideal terminologies but would hopefully convey what I'm trying to do

https://mirror.codeforces.com/contest/1948/submission/267884593

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ahmadexe 2024-06-28 19:40:41 5 Tiny change: 'fine to me\nI have a' -> 'fine to me.\n\n\nI have a'
en1 English ahmadexe 2024-06-28 19:40:12 394 Initial revision (published)