#C1182. Domino Tilings of an Even Grid
Domino Tilings of an Even Grid
Domino Tilings of an Even Grid
Given an even-dimensional grid of size \(N \times M\) (both \(N\) and \(M\) are even), compute the number of distinct ways to completely cover the grid using \(2 \times 1\) dominoes.
For certain grids, the answer is predefined as follows:
- \(N=2, M=2\): 2
- \(N=2, M=4\): 5
- \(N=4, M=4\): 36
- \(N=6, M=8\): 153
- \(N=8, M=8\): 12988816
For all other even dimensions, the complete solution is non-trivial, and for the purpose of this problem, return None
.
inputFormat
The input consists of a single line containing two space-separated even integers (N) and (M).
outputFormat
Print a single line that contains the number of distinct tilings if the grid size matches one of the predefined cases; otherwise print None.## sample
2 2
2
</p>