Maths Olympiad Prep

Track / Stage 7 / 173 of 300 #2053 of 2444

Problem 2053

National Olympiad second round; IMO P1/P4
Combinatorics Difficulty 7.4 Prove it Japanese Mathematical Olympiad, Final Round · Japan · 2019

Let nn be an odd integer greater than or equal to 33. Suppose you play the following game using an n×nn \times n grid made up of n2n^2 1×11 \times 1 squares. The game consists of n2n^2 turns, and at each turn the following actions must be performed in the order specified:
* Choose one empty square and insert one positive integer greater than or equal to 11 and less than or equal to n2n^2. Throughout the game, any integer can be used only once.
* You gain 11 point if the sum of numbers written into the squares lying on the same row as the square you chose is a multiple of nn, and the same rule applies for the column (you get 22 points if both row sum and column sum are multiples of nn.)

Find the maximum possible value for the total sum of the points you gain by the end of the game.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

It is clear that whether the number inserted at every turn matters for the point(s) earned or not depends only on the remainder obtained when that number is divided by nn. Therefore, we may assume that every integer kk satisfying 0kn10 \le k \le n - 1 will be inserted into squares exactly nn times.

Let us show that the value we seek as the answer to the problem is n(n+1)n(n+1). We first exhibit a method of inserting numbers for which the total number of points earned at the end of the game is exactly n(n+1)n(n+1). This method tells us to insert into the square located at the ii-th row from the top and jj-th column from the left the number obtained as the remainder when i+ji+j is divided by nn. If 00 is inserted nn times, 11 is inserted nn times, n1n-1 is inserted nn times, 22 is inserted nn times, n2n-2 is inserted nn times, ..., then, whenever 0,n1,n2,,n+120, n-1, n-2, \dots, \frac{n+1}{2} are inserted, 22 points are earned so that the total of n(n+1)n(n+1) points will be earned at the end.

Next, let us show that the total number of points earned by the end of the game can be at most n(n+1)n(n+1). Let A0=B0=0A_0 = B_0 = 0. For any ii satisfying 1in21 \le i \le n^2, let Ai=Ai1+1A_i = A_{i-1} + 1 if the sum of the numbers written into the squares lying on the same row of the grid as the square into which a number is inserted at the ii-th turn (which is included in the sum) is a multiple of nn, and Ai=Ai1A_i = A_{i-1} otherwise. We define BiB_i's for columns in the same way. Then, the total sum of the points earned at the end of the game is given by An2+Bn2A_{n^2} + B_{n^2}.

Let us consider the maximum value that An2A_{n^2} can take. For every ii satisfying 0in20 \le i \le n^2, let us denote by CiC_i the number of columns for which the column-sum of the numbers inserted into the squares is not a multiple of nn right after the end of ii-th turn. We also let C0=0C_0 = 0. Then, we see that Ai+12CiA_i + \frac{1}{2}C_i increases, in comparison with Ai1+12Ci1A_{i-1} + \frac{1}{2}C_{i-1} at most by 11 if 00 is the number inserted at the ii-th turn, and at most by 12\frac{1}{2} otherwise. Since 00 is inserted nn times and non-zero nn is inserted n2n=n(n1)n^2 - n = n(n - 1) times, we see that
An2+12Cn2n+n(n1)2=n(n+1)2 A_{n^2} + \frac{1}{2}C_{n^2} \le n + \frac{n(n-1)}{2} = \frac{n(n+1)}{2}
must hold. Since Cn2C_{n^2} is a non-negative integer, we conclude that An2n(n+1)2A_{n^2} \le \frac{n(n+1)}{2} must be satisfied. By the same argument we obtain Bn2n(n+1)2B_{n^2} \le \frac{n(n+1)}{2}. Therefore, the maximum of the total points we obtain at the end of the game is n(n+1)n(n+1).

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty, ordering) added by this project.