1146 - Closest Distance, Ternary search problem