Binary Search + DP