WA in SPOJ question Longest Path In a Tee

Правка en1, от vee_sharp, 2015-12-24 21:38:34

Hello I am trying to solve the question :http://www.spoj.com/problems/PT07Z/ in SPOJ. I have used bfs to find the leaf node and then used bfs again to find the maximum path. I know there are other methods to solve this like simply finding the diameter of a tree in O(n) time. But I am trying this approach and I don't know what is causing the error. Here is a link to my solution http://ideone.com/QSJzDf.

Теги spoj, c++, bfs

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский vee_sharp 2015-12-24 21:46:06 106
en2 Английский vee_sharp 2015-12-24 21:42:09 13 Tiny change: 'a tree in O(n) time. But I am' -> 'a tree in one loop. But I am'
en1 Английский vee_sharp 2015-12-24 21:38:34 447 Initial revision (published)