Definitely 500 or 600 points question


#1

This question involves binary lifting, which is definitely not worth 200 points. And I was somewhat proficient in this topic, still took me 75 minutes to write the code. So don’t feel demotivated if you don’t know this topic and take more than 3 hours to do this.

For those who don’t know binary lifting, see the LCA video by Gaurav Sen on youtube.