Olympiad Maths Prep

Library / /10 of 11

Combinatorics Difficulty 7.3 National olympiad, round 2 Prove it Czech Republic

We have n2n^2 empty boxes; each of them having square base. The height and the width of each box belongs to {1,2,,n}\{1, 2, \dots, n\} and every two boxes differ in at least one of these two dimensions. One box fits into another one if both its dimensions are smaller and at least one is smaller by at least 2. In this way, we can form sequences of boxes (the first one in the second one, the second one in the third one, and so on). We put any such set of boxes on a different shelf. How many shelves do we need to store all the boxes? (Peter Novotný)

Solution

We will show that the required minimal number of shelves is 3n23n-2. This answer is clearly correct for n=1n=1 and n=2n=2 since for such nn we have n2=3n2n^2 = 3n - 2 and each box has to be stored on a different shelf. From now on, let n3n \ge 3.
We identify boxes with points in an n×nn \times n grid: A box of width ww and height hh corresponds to point with coordinates (w,h)(w, h).
No two boxes from the set S={(w,h):nw+hn+2}S = \{(w,h): n \le w+h \le n+2\} (three longest diagonals, see Fig. 1 for n=7n=7) can be on the same shelf: Indeed, Assume (w,h)(w,h) and (w,h)(w',h') are on the same shelf and w<w,h<hw < w', h < h'. Then w+1w,h+1hw+1 \le w', h+1 \le h', and either w+2ww+2 \le w' or h+2hh+2 \le h'. Either way, summing up we obtain w+h+3w+hw+h+3 \le w'+h'.

Figure 1
Fig. 1
Figure 2
Fig. 2
If (w,h)S(w, h) \in S then w+hw+h+3n+3w' + h' \ge w + h + 3 \ge n + 3, hence (w,h)S(w', h') \notin S. As S=3n2|S| = 3n - 2, we need at least 3n23n - 2 shelves.
Now we show how to split the boxes so that 3n23n-2 shelves are enough. A possible way for n=7n=7 is clear from Fig. 2 (the sequences of boxes stored inside one another are illustrated by arrows) and it can be directly generalised to any n3n \ge 3. Two boxes (w,h)(w, h), (w,h)(w', h') are put on the same shelf if and only if 2(hh)=ww2(h' - h) = w' - w. In other words, we start with “largest” boxes (n1,h)(n-1, h), (n,h)(n, h) for h=1,2,,nh = 1, 2, \dots, n and (w,n)(w, n) for w=1,2,,n2w = 1, 2, \dots, n-2, and we put each of these 3n23n-2 boxes on a different shelf. Then we follow the following algorithm on each shelf: Assume the last box put on the shelf is (w,h)(w, h). If w21w-2 \ge 1 and h11h-1 \ge 1, we add box (w2,h1)(w-2, h-1) to the shelf (inside the previous box) and repeat this step; otherwise we end. Obviously, the arrangement of boxes on every shelf satisfies the requirements. Moreover, each box is stored on exactly one shelf: To identify it, keep increasing ww by 2 and hh by 1 (simultaneously) until w{n1,n}w \in \{n-1, n\} or h=nh = n. Thus 3n23n-2 shelves are also sufficient.

Looking for a route rather than 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.