Skip to main content
OlympiadHQ

Browse · MathNet

Print

Bulgarian National Mathematical Olympiad

Bulgaria counting and probability

Problem

Consider a rectangular table where and are positive integers. Each cell is colored in one of the four colors: white, green, red or blue. Call such a coloring interesting if any square contains every color exactly once. Find the number of interesting colorings.
Solution
Number the columns of the table by and its rows by and denote the cell in the -th column and -th row by .

Consider an interesting coloring . We show first that either any row in contains only two colors or any column in contains only two colors.

Suppose does not contain a rectangle (with longer horizontal side) containing three distinct colors. It follows that in any row of we have two alternating colors, as needed.

Let the cells , and be covered in three distinct colors and . We obtain that is colored in the fourth color , in , in , in , in , in , and so on. By analogy we obtain that is in color , in , in and so on. We conclude that column contains only colors and , column contains only colors and , and column contains only colors and . It follows now that any column having the same parity as contains only colors and , and any column having the parity of contains only colors and .

Hence, either any row in contains only two colors or any column in contains only two colors.

The number of interesting colorings such that in any column of odd number two of the colors alternate and in any column of even parity the other two colors alternate is equal to . The corresponding colorings when the rows are colored in two colors equal . The colorings in which the color of the cell depends only on the parity of and are counted in both cases. Therefore, the number of interesting colorings equals .
Final answer
6*(2^m + 2^n) - 24

Techniques

Coloring schemes, extremal argumentsInclusion-exclusion