ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2034. Caravans

WA on Case#14
Posted by Iftekher Toufique Imam 23 Jan 2018 20:14
Passed all the test given in the discussion
I ran 1 bfs from 'r' and another bfs from 's' where i also kept data for those nodes who can have multiple parents.
than I while restoring path from destination to source I selected the node who has higher level from 'r' (that selection occurs if only the node has possibility multiple parents)
returned the ans which is the minimum among the final path