Garmaine Staff asked 2 years ago

I was learning MO's Algorithm. In that I found a question. In which we have to make a program to take input n for n nodes of a tree then n-1 pairs of u and v denoting the connection between node u and node v. After that giving the n node values.

Then we will ask q queries. For each query we take input of k and l which denote the two nodes of that tree. Now we have to find the product of all the nodes in the path of k and l (including k and l).

I want to use MO's algorithm. https://codeforces.com/blog/entry/43230

But I am unable to make the code. Can anybody help me out in this.