Problem: 13101 — Tobby On Tree
The problem is, You are given a tree. In every node, there is a value assigned to it and also given some query.
1 u v: compute the gcd on the path from u to v.
2 u x: Change the value of the node u to x.
I have written a code of HLD and submitted but it gave me TLE. I haven't found anything in the code to optimize.
In this case, I need help to optimize the code if it is possible. Please help me if you are free.
Thanks in Advance :)