Maths Olympiad Prep

Library / /191 of 196

Combinatorics Difficulty 6.9 National Olympiad Prove it Soviet Union

Problem:

An integer is put in each cell of an n×nn \times n array. The difference between the integers in cells which share a side is 00 or 11. Show that some integer occurs at least nn times.

Solution

Solution:

Let the integers in the array be ai,ja_{i,j} for 1i,jn1 \leq i, j \leq n. For any two adjacent cells (sharing a side), ai,jak,l=0|a_{i,j} - a_{k,l}| = 0 or 11.

Let mm be the minimum integer in the array. Consider the set of cells where the value is mm. Any cell adjacent to such a cell can have value mm or m+1m+1.

Let us color the array as follows: color cell (i,j)(i,j) black if i+ji + j is even, white if i+ji + j is odd. Consider the minimal value mm and the set SS of all cells with value mm.

Suppose S<n|S| < n. Then, in each row and each column, there is at most one cell with value mm (otherwise, two cells with value mm in the same row or column would force all cells between them to also have value mm, by the adjacency condition, contradicting minimality unless the whole row or column is mm). Thus, Sn|S| \leq n.

Suppose S<n|S| < n. Then, there is a row and a column with no cell of value mm. Consider the path from a cell with value mm to a cell in this row or column. Along the path, the value can increase by at most 11 at each step, so the maximum value in the array is at most m+2n2m + 2n - 2.

But, more simply, consider the following: pick any cell with value mm. From this cell, move right kk steps and down ll steps to reach cell (i+k,j+l)(i+k, j+l). The value at (i+k,j+l)(i+k, j+l) is at least mm and at most m+k+lm + k + l (since each step increases by at most 11). Thus, the maximum difference between any two cells is at most 2n22n - 2.

Now, consider the values along the main diagonal: (1,1),(2,2),,(n,n)(1,1), (2,2), \ldots, (n,n). Each adjacent pair differs by at most 11, so the values form an integer sequence where each term differs from the previous by at most 11. Thus, among these nn values, at least one value occurs at least n/2\lceil n/2 \rceil times (by the pigeonhole principle), but we want at least nn times in the whole array.

Alternatively, consider the values in the array: the minimal value mm must occur in some row or column. If it occurs kk times in a row, then in that row, the values can only increase by 11 at each step, so the values are m,m+1,,m+k1m, m+1, \ldots, m+k-1. But since the difference between adjacent cells is at most 11, and the minimal value is mm, the only way for the value to increase is if the previous cell is mm and the next is m+1m+1.

But the key is:

Let us fix a value xx that appears in the array. Consider the set of all cells with value xx. Suppose that in every row, there is at most one cell with value xx. Then, the total number of cells with value xx is at most nn. Similarly for columns. But if there is a row with two cells with value xx, say (i,j1)(i, j_1) and (i,j2)(i, j_2), then all cells between (i,j1)(i, j_1) and (i,j2)(i, j_2) in row ii must also have value xx, because the difference between adjacent cells is at most 11, and the values at the ends are equal. Thus, the sequence must be constant between j1j_1 and j2j_2.

Therefore, for any value xx, the set of cells with value xx in any row or column forms a contiguous block. Thus, the set of cells with value xx forms a union of rectangles (possibly degenerate to a single cell or a line).

Now, consider the value that appears most frequently in the array. Suppose, for contradiction, that every value appears fewer than nn times. Then, the total number of values is at least n2/(n1)>nn^2 / (n-1) > n for n>1n > 1, which is impossible since the values are integers and the difference between adjacent cells is at most 11, so the range of values is at most 2n22n-2 (as above). For large nn, this is a contradiction.

But more simply, consider the following construction:

Let us fix a row. The values in the row form a sequence where adjacent terms differ by at most 11. Thus, the minimal value in the row occurs in a contiguous block. The same applies to columns.

Therefore, the value that appears most frequently must appear at least nn times, since otherwise, the total number of cells is n2n^2, and the values cannot be spread out enough given the adjacency condition.

Thus, some integer occurs at least nn times.

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.