This problem is in Contest(s) below:
Contest 1006:分治算法