This problem is in Contest(s) below:
Contest 1297:二分法
Contest 1357:分治算法