Given n points, and an integer K(<=n/2) . I need to enclose K points in two rectangles such that each contain K/2 points and their perimeter is minimum. I need to output sum of perimeter of both rectangles.

How can i do this efficiently?

Given n points, and an integer K(<=n/2) . I need to enclose K points in two rectangles such that each contain K/2 points and their perimeter is minimum. I need to output sum of perimeter of both rectangles.

How can i do this efficiently?