Maths Olympiad Prep

Library / /21 of 24

, 2021

Combinatorics Difficulty 5.8 AIME, harder Prove it United States

Problem:

In an n×nn \times n square grid, nn squares are marked so that every rectangle composed of exactly nn grid squares contains at least one marked square. Determine all possible values of nn.

Solution

Solution:

In this solution, we will reference cells by row and column, measured from left to right and top to bottom. The cell at (0,0)(0,0) is then in the top-left corner; the cell at (1,3)(1,3) is in the fourth cell of the second row.

(0,0)(0,0)
(1,3)(1,3)

We begin by constructing solutions for the possible values of nn.

For n=1n=1, we can mark the sole cell.

For n=pn=p, where pp is a prime, we need only ensure that each 1×n1 \times n and n×1n \times 1 rectangle contains a mark. This is the same as ensuring that all rows and columns contain a mark, which can be done, for example, by marking all cells (k,k)(k, k) for integers k[0,n)k \in[0, n).

For n=p2n=p^{2}, there must be a mark in each row and column and also in each p×pp \times p rectangle. To achieve this, we can mark all cells of the form (j+kp,k+jp)(j+k p, k+j p), for integers j,k[0,p)j, k \in[0, p). An illustration for n=9n=9 follows:

Figure 1

Note that there are exactly p2=np^{2}=n such cells, and that row rr contains a cell in the column
rp+(rmodp)p \left\lfloor\frac{r}{p}\right\rfloor+(r \bmod p) \cdot p
Likewise, there is a marked cell in each column. Now, we will show that all p×pp \times p rectangles contain a marked cell. Consider the rectangle RR with upper-left corner at (xp+y,z)(x p+y, z) for integers x,y[0,p),z[0,n)x, y \in[0, p), z \in [0, n). Then, if z>x+(y1)p,Rz>x+(y-1) p, R contains the cell
(xp+zxp,x+zxpp) \left(x p+\left\lceil\frac{z-x}{p}\right\rceil, x+\left\lceil\frac{z-x}{p}\right\rceil p\right)
and otherwise it contains the cell
((x+1)p+zxp,x+zxpp+1). \left((x+1) p+\left\lfloor\frac{z-x}{p}\right\rfloor, x+\left\lfloor\frac{z-x}{p}\right\rfloor p+1\right) .
Since znpz \leq n-p, this cell is always a valid marked cell. This concludes the proof that the construction is correct.

Now, we prove that no other values of nn are satisfiable. First, we again note that every row and column must have exactly one marked cell, as there are nn of each and they are disjoint. Let n=abn=a b for 1<a,b<n1<a, b<n and partition the n×nn \times n grid into a b×ab \times a grid of a×ba \times b rectangles. In particular, let RijR_{i j} be the rectangle that has upper-left corner at (bi,aj)(b i, a j) and lower-right corner at (bi+b1,aj+a1)(b i+b-1, a j+a-1) for i[0,a),j[0,b)i \in[0, a), j \in[0, b). Then each RijR_{i j} must contain exactly one marked cell, since there are also nn of them and they are disjoint.

Consider the set of rectangles Ri0R_{i 0}. There are exactly aa marked cells among these rectangles - one in each of the columns from 00 to a1a-1, and also one in each of the aa rectangles Ri0R_{i 0}. Therefore, there is some permutation XX of the integers [0,a)[0, a) so that Ri0R_{i 0} has a marked cell in column XiX_{i}. Now, we will prove the claim that if a rectangle RijR_{i j} contains a marked cell in column cc of the grid, cXi(moda)c \equiv X_{i}(\bmod a). We prove this by induction on jj, having already demonstrated the case j=0j=0. Suppose the claim holds for some jj; we will show it must also hold for j=j+1j' = j+1. Consider kk satisfying Xk=0X_{k}=0. We know that the unique marked cell in rectangle RkjR_{k j} is in column aja j. Therefore, RkjR_{k j'} must contain a mark in column aj+aa j+a, as otherwise the a×ba \times b rectangle with top-left corner at (bk,aj+1)(b k, a j+1) has no mark. Next, consider kk' satisfying Xk=1X_{k}=1. The unique marked cell in rectangle RkjR_{k' j} is in column aj+1a j+1. Also, the rectangle RkjR_{k' j'} cannot contain a marked cell in column aj+aa j+a, since there is already a mark in that column. So RkjR_{k' j'} must contain a marked cell in column aj+a+1a j+a+1, as otherwise the a×ba \times b rectangle with upper-left corner at (bk,aj+2)(b k, a j+2) has no mark. Proceeding in order of increasing XiX_{i} in this way forces the claim to hold for kk' as well, completing the inductive proof.

Likewise, there is a permutation YY of the integers [0,b)[0, b) so that, if RijR_{i j} contains a marked cell in row rr of the grid, rYj(modb)r \equiv Y_{j}(\bmod b).

We will now show that either XX and YY are both increasing or both decreasing. Suppose not, so that for some i,j,Xi>Xi+1i, j, X_{i}>X_{i+1} and Yj<Yj+1Y_{j}<Y_{j+1} (or the same with X,YX, Y swapped, which is handled identically). Then, consider the rectangles Rij,R(i+1)j,Ri(j+1)R_{i j}, R_{(i+1) j}, R_{i(j+1)}, and R(i+1)(j+1)R_{(i+1)(j+1)}. An example for n=6n=6 follows:

Figure 2

Taking an a×ba \times b rectangle with upper-left corner directly below the marked cell in RijR_{i j}, we find that it lies entirely inside these four rectangles and yet does not contain any of their marked cells. In particular, we can note that, since YY is increasing at this point, the horizontal distance between the marks in the lower left and upper right is strictly greater than aa. Also, since XX is decreasing at this point, the vertical distance between the marks in the top left and lower right is strictly greater than bb. This means that an a×ba \times b rectangle with no mark exists, a contradiction. Therefore, either XX is increasing or YY is decreasing.

Suppose, without loss of generality, that both are increasing (noting that the increasing and decreasing cases are simply 9090^{\circ} rotations of each other). Then the marked cell in row 11 must be a+1a+1. But if nn is divisible by two distinct primes or the cube of a prime, there is no unique value for aa, which is a contradiction. Therefore, nn must be 11, a prime, or the square of a prime.

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 reproduced verbatim; metadata (topic, difficulty) added by this project.