Quantcast
Channel: Active questions tagged tiling - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 35

Maximal saturated domino covering of a rectangle

$
0
0

Inspired by this OEIS entry.

Background

A saturated domino covering is a placement of dominoes over an area such that

  1. the dominoes are completely inside the area,
  2. the dominoes entirely cover the given area,
  3. the dominoes may overlap, and
  4. removal of any domino reveals an uncovered cell (thus failing to satisfy condition 2).

The following is an example of a maximal such covering of 3 × 3 rectangle (since dominoes may overlap, each domino is drawn separately):

AA.   B..   ..C   ...   ...   ......   B..   ..C   .D.   ...   ......   ...   ...   .D.   EE.   .FF

Challenge

Given the dimensions (width and height) of a rectangle, compute the maximum number of dominoes in its saturated domino covering.

You can assume the input is valid: the width and height are positive integers, and 1 × 1 will not be given as input.

Standard rules apply. The shortest code in bytes wins.

Test cases

A193764 gives the answers for square boards. The following test cases were verified with this Python + Z3 code (not supported on TIO).

Only the test cases for n <= m are shown for brevity, but your code should not assume so; it should give the same answer for n and m swapped.

n m => answer1 2 => 11 3 => 21 9 => 61 10 => 62 2 => 22 3 => 42 5 => 73 3 => 63 4 => 83 7 => 154 4 => 124 7 => 21

Viewing all articles
Browse latest Browse all 35

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>