Блог пользователя vee_sharp

Автор vee_sharp, история, 9 лет назад, По-английски

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 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.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Your answer on this test is wrong. Paint this graph (at input section).
To solve this problem it is better to use "Adjacency lists", instead of "adjacency matrix". Your matrix g is too big and you create it using 8-bytes type "long long int" and on the stack.