VIKRAM91's blog

By VIKRAM91, history, 6 years ago, In English

I am doing BENEFACT — The Benefactor.

I am using 2-time BFS method to calculate the longest path. Because here cost is associated with every edge so I am doing 2 times Dijkstra instead of 2 times BFS. But I am getting WA.

Can Anyone tell me Why I am getting WA?

Here is my code.

Edit:- Now I have done uknowg BFS instead of Dijkstra and I got Ac. Here is my code.

I want to now why solution using Dijkstra give WA and BFS gives AC.

Can Anyone help me? Please

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Dont think dijkstra's will work here. You can check my implementation if that helps.submission

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you -Pannu-.

    Can tell me why Dijkstra's not working here?