Given a tree of n vertices (n <= 1e5) in which the edge is arbitrarily oriented. Also given q queries (q <= 1e5) in which a, b are entered. The problem is quickly answer whether there is a path from a to b.
Thank a lot for your help.
Help with the problem
Given a tree of n vertices (n <= 1e5) in which the edge is arbitrarily oriented. Also given q queries (q <= 1e5) in which a, b are entered. The problem is quickly answer whether there is a path from a to b.
Thank a lot for your help.