Problem link: http://lightoj.com/volume_showproblem.php?problem=1359
For PDF click here
I think this is a very interesting problem. It is a LightOJ problem and catagorized under LCA/RMQ. What can be the solution idea for this problem? I can't find one, please help.