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.
In fact, this problem requires the use of "Dominator Tree". To know more about this data structure and how it works, you may look into this blog .