Farmer John keeps N cows, and every cow stands at a different position in his two dimensional field. John wants one rectangular fence that encloses all of the cows. Its sides are parallel to the x and y axes, and among all rectangles that contain every cow it has the smallest area. A cow on the boundary counts as enclosed.
Milk production dropped last quarter, so the budget is tight. To cut the maintenance cost John wants to build two enclosures instead of one and fence a smaller total area. The two enclosures are also rectangles with sides parallel to the x and y axes, together they must contain every cow, and they may not overlap, not even on their boundaries. An enclosure of zero area is allowed, so an enclosure may have zero width or zero height.
Compute the area of the single enclosure minus the smallest possible total area of two enclosures.