
Counting Castles
We define a block to be a rectangle with a height of
Given a game grid that is
- Blocks can be placed on top of other blocks as long as nothing sticks out past the edges or hangs out over open space.
- All blocks are aligned/snapped to the grid.
- Any two neighboring blocks on the same row have at least one unit of space between them.
- The bottom row is occupied by a block of length
. - The maximum achieved height of the entire castle is exactly
. - The castle is made from an even number of blocks.
The following is a sample castle for
Let
For example,
Find