I am trying to solve the problem QTREE4 but can not get any working solution. I have seen some solutions use Heavy-Light decomposition and Heap but could not make out the algorithm by seeing their code. Can anybody help me in solving this problem ? Thank you in advance.
Can anyone give suggestions ??