maximum number of dominoes can be placed inside a figure

后端 未结 2 1166
别跟我提以往
别跟我提以往 2020-12-16 01:31

Suppose some figure on the squared paper. Sides of the figure go straight on the lines of squared paper. Figure may have any (not even convex) shape. How to find the maximum

相关标签:
2条回答
  • 2020-12-16 02:04

    Looks like the maximum cardinality matching problem in a bipartite graph. The squares are the vertices and the dominoes are the edges that belong to the matching.

    To see that the graph is bipartite, imagine the squares are checkerboard-painted. Black ones only neighbour white ones and vice versa.

    0 讨论(0)
  • 2020-12-16 02:24

    You can classify squares by the number of neighbor free squares as type 0, 1, 2, 3 or 4.

    I believe that should work:

    1. find a type 1 square, place there a domino in the only possible way and repeat

    2. else, find a free corner formed by two contiguous type 2 and type 3 squares, place there a domino and go to 1

    3. else, place a domino in any type 2 square and go to 1

    4. you are done

    0 讨论(0)
提交回复
热议问题