Pratition rectangle into smaller ones containig exactly 1 point, maximize wastelands area

后端 未结 2 937
面向向阳花
面向向阳花 2021-02-11 06:10

Given a rectangle R containing P points, orthogonal with axes, points are natural numbers.

Parcel is a rectangle which:

  • is totally inside
2条回答
  •  滥情空心
    2021-02-11 06:35

    Brute force is to find for each point all possible rectangles that contain that point (in inside) and solve exact cover set problem on collection of all rectangles.

    To find all rectangles that contain given point is 'relatively' simple :-)

    Start with a rectangle that have maximal one side. E.g. for point (a,b) rectangle with maximal y side is one that has vertical boundaries on points which x coordinate is nearest to a (from both sides) and horizontal boundaries are on R. That is not case if there is other point(s) with x coordinate equal a, but that will only move horizontal boundary to the nearest point in y direction.

    Next rectangle has to have smaller y side, that means that boundary point (B) that was used for vertical boundary in shorter rectangle is used for horizontal boundary. Point for vertical boundary is choose from point from same side as B to support rectangle constraints (create rectangle, no other point in rectangle area.)

提交回复
热议问题