Please explain..

Revision en2, by GonnaTry, 2023-12-29 15:32:43

I was recently solving (https://codeforces.com/contest/1900/problem/C) . I did DFS approach first https://codeforces.com/contest/1900/submission/239489864. But it gave TLE on testcase 5 but when did using BFS 239489864. It got accepted but why? Both are just brute force yet one works not other. Please help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English GonnaTry 2023-12-29 15:32:43 51
en1 English GonnaTry 2023-12-29 15:32:05 352 Initial revision (published)