CSES Longest Flight Route TLE in one test case

Правка en2, от salt_n_ice, 2020-12-03 13:40:55

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

My solution

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

Теги graph, #dfs, #bfs, #cses

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский salt_n_ice 2020-12-03 13:46:13 56
en4 Английский salt_n_ice 2020-12-03 13:45:53 62 Tiny change: 'Problem : ' -> '<spoiler summary="Spoiler">\n...\n..testing\n</spoiler>\nProblem : '
en3 Английский salt_n_ice 2020-12-03 13:41:51 16
en2 Английский salt_n_ice 2020-12-03 13:40:55 73
en1 Английский salt_n_ice 2020-12-03 13:39:52 1329 Initial revision (published)