This problem is in Contest(s) below:
Contest 1157:树链剖分入门
Contest 1223:线段树&&树链剖分
Contest 1130:十月队测题
Contest 1170:备战Noip2018
Contest 1290:Treap,FHQ Treap,Splay,线段树标记永久化