CSES Longest Flight Route TLE in one test case

Revision en5, by salt_n_ice, 2020-12-03 13:46:13

Problem : Link. I simply did bfs from node 1 and found the maximum distance from this node to all other nodes

Code

So the solution is O(n+m) but still, there is TLE in one case. Why?

Tags graph, #dfs, #bfs, #cses

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English salt_n_ice 2020-12-03 13:46:13 56
en4 English salt_n_ice 2020-12-03 13:45:53 62 Tiny change: 'Problem : ' -> '<spoiler summary="Spoiler">\n...\n..testing\n</spoiler>\nProblem : '
en3 English salt_n_ice 2020-12-03 13:41:51 16
en2 English salt_n_ice 2020-12-03 13:40:55 73
en1 English salt_n_ice 2020-12-03 13:39:52 1329 Initial revision (published)