Not able to figure out why my code is not optimal

Revision en2, by arnav2004, 2022-01-13 16:42:43

I was solving this problem on the CSES Problemset Longest Flight Route.

Here is my code

The code is getting Accepted in all but 2 testcases(TLE in those 2) .

I cannot debug with those testcases since they are HUGE.

I reckon that the problem is in my BFS Code but I can't seem to find why it would go in an infinity loop.

If anyone could provide a testcase or something it would be incredibly helpful.

Thanks.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English arnav2004 2022-01-13 16:42:43 7 (published)
en1 English arnav2004 2022-01-13 16:39:53 1489 Initial revision (saved to drafts)