Help with understanding difference between correct and incorrect code (Longest Flight Route CSES)

Revision en1, by m_nigam01, 2024-04-04 12:12:41

Hello all,

I'm solving Problem using dfs and dp.

Here is the accepted solution https://cses.fi/paste/0ce952848211df07881291/ logic above is to store u->v to store the child who gives best result

Here is the incorrect solution https://cses.fi/paste/7036dbe274524616881807/ logic above is to store u->v to store parent and backtrack to parent

since the test cases are long i can't debug the code myself.

the code start from line 381.

Please anyone can help me why it is giving wrong output.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English m_nigam01 2024-04-04 12:12:41 648 Initial revision (published)