TLE on CSES Graph Question Labyrinth

Revision en2, by osource, 2020-10-22 20:22:44

Hello,

I was solving CSES problemset and am stuck in this question — Question My code — Code

I am getting TLE on 4 test cases. I'm not able to figure out why as I have used standard BFS and therefore the time complexity should be O(m*n). Can someone help me in this?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English osource 2020-10-22 20:22:44 8
en1 English osource 2020-10-22 20:21:46 384 Initial revision (published)