Not able to figure out why my code is not optimal

Правка en1, от arnav2004, 2022-01-13 16:39:53

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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский arnav2004 2022-01-13 16:42:43 7 (published)
en1 Английский arnav2004 2022-01-13 16:39:53 1489 Initial revision (saved to drafts)