Maths Olympiad Prep

Library / /86 of 86

Combinatorics Difficulty 7.8 National olympiad, round 2 Prove it Estonia

There is a rectangular grid with 3 rows and nn columns on a blackboard.

a. Find the number of ways to write exactly one of numbers 1,2,,3n1, 2, \ldots, 3n into each square in such a way that all the following conditions are met:
(1) Different squares contain different numbers.
(2) For each i=1,2,,3n1i = 1, 2, \ldots, 3n - 1, the numbers ii and i+1i + 1 are written into adjacent squares (i.e., squares having a common side).
(3) The numbers 11 and 3n3n are written into adjacent squares.

b. The same question, but as the 3rd condition, the number 11 must be written into the leftmost and the number 3n3n into the rightmost column.

Solution

(a) Note that all three squares in the leftmost and rightmost columns must be traversed consecutively because along with both corner squares of either of the columns one has to traverse the middle square of the same column and this cannot be done twice. In no other column can one traverse all three squares consecutively because such column would divide the grid into two parts between which one could not move without visiting a square twice. Note also that one cannot traverse three or more consecutive squares of the middle row consecutively because such trajectory would also divide the grid into two isolated parts (Figures 15 and 16). For similar reasons, when visiting two consecutive squares of the middle row consecutively, the previous and the next square should be taken from one and the same row (either top or bottom).
Hence apart from the first and the last column, every legal trajectory divides the middle row into pairs of squares that are visited consecutively. Therefore the required enumeration is impossible for odd nn. For even nn, one can choose for every pair of squares in the middle row the row where the previous and the next square are located (either top or bottom); the number of such pairs of squares is n22\frac{n-2}{2}, whence there are 2n222^{\frac{n-2}{2}} possibilities to choose the direction of continuation for every such pair of squares. The whole trajectory is determined by these choices. For writing numbers in the case of a fixed trajectory, there are 6n6n possibilities (2 possibilities to choose the direction and 3n3n possibilities to choose the initial square). Consequently, there are 6n2n22=3n2n26n \cdot 2^{\frac{n-2}{2}} = 3n \cdot 2^{\frac{n}{2}} possibilities of the required enumeration for even nn.

(b) One cannot start from the middle square of the leftmost column since either of the corner squares would become a dead end. Hence suppose w.l.o.g. that one starts from the top left corner and visits kk squares in the top row (inclusive of the initial square), where 1kn1 \le k \le n (Fig. 17). Going directly to the bottom row would generally divide the grid into two isolated parts; also turning to the right along the middle row would make it impossible to visit squares in the left and afterwards reach the rightmost column. Hence one should turn to the left along the middle row. Similarly we find that the leftmost part of size 3×k3 \times k of the grid should be traversed along Z-shape (Fig. 18). After that, one should follow similar rules to traverse the remaining part of size 3×(nk)3 \times (n-k).
Repeating the argument, we can see that every legal trajectory divides the grid into Z-shapes and S-shapes, whereby Z-shapes are immediately followed by S-shapes and vice versa. In every column but the last one we can choose whether to start a new letter or make the current letter wider. In the first column, we also can choose which corner to start in. Hence there are 2n2^n possibilities altogether.

Figure 1
Fig. 15
Figure 2
Fig. 16
Figure 3
Fig. 17
Figure 4
Fig. 18

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic and difficulty added by this site.