This problem is in Contest(s) below:
Contest 1512:分块与莫队
Contest 1524:分块与莫队_YC
Contest 1236:分块&&莫队&&树上莫队