Intersecting Path question in codechef JUNE long challenge

Revision en2, by carnage17, 2019-06-17 17:54:29

Here is the problem link and problem statement is pretty short you can have a go at it.
I was able to get 30 points on this question and then I thought if there is a way to order the queries to reduce time complexity but wasn't able to come up with anything.

Even though the editorial is pretty clear I am not able to understand it, Can someone share their approach on how to solve this problem.

Tags path query, #trees, lca, codechef long

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English carnage17 2019-06-17 17:54:29 6 Tiny change: 'o at it.\nI was ab' -> 'o at it.\n<br>\nI was ab'
en1 English carnage17 2019-06-17 17:53:47 511 Initial revision (published)