Lattice Animals
Time limit2sMemory limit128 MB
Count free n-polyominoes (up to rotation and reflection) that fit inside a w by h rectangle, with n up to 10.
- Level
Medium7 of 10
- Topics
- Backtracking, Brute force, Geometry, Hash map
- Solved
- No attempts yet
Problem
A lattice animal is a set of connected cells on a lattice. Lattice animals on a square lattice are an especially popular subject of study and are also known as polyominoes. A polyomino is usually represented as a set of edge-connected unit squares. A polyomino with squares is called an -polyomino.
In this problem you must find the number of distinct free -polyominoes that fit into a rectangle. Free polyominoes may be rotated and flipped over, so their rotations and mirror images are considered to be the same.
For example, there are 5 different pentominoes (5-polyominoes) that fit into a rectangle, and 3 different octominoes (8-polyominoes) that fit into a rectangle.

Input
The input consists of a single line with three integers , , and (, ).
Output
Output a single integer — the number of distinct free -polyominoes that fit into a rectangle.