C++20 sections · 1024 units
Open in Course

Problem - Domino piling

Fitting dominoes on a board

You have an M×NM \times N board and dominoes that cover exactly 2×12 \times 1 cells. Your task: find the maximum number of dominoes you can place on the board without overlaps. For example, a 2×42 \times 4 board fits 4 dominoes.

This problem teaches you to recognize when complex problems have simple solutions. You might think you need to simulate placing dominoes, but there's a direct mathematical approach that runs instantly.

Before reading the solution, think about this: what relationship exists between the board's total area and the number of dominoes you can fit?