Olympiad Maths Prep

Track / Stage 10 / 12 of 40 #1972 of 2000

Problem 1972

Hardest shortlist tier
Combinatorics Difficulty 9.3 Prove it Team Selection Test · United States

There are 20102010 students and 100100 classrooms in the Olympiad High School. At the beginning, each of the students is in one of the classrooms. Each minute, as long as not everyone is in the same classroom, somebody walks from one classroom into a different classroom with at least as many students in it (prior to his move). This process will terminate in MM minutes. Determine the maximum value of MM.

This one wants a proof. Work it on paper, read the official solution, then mark yourself honestly — the ladder only means something if the record is true.

Official solution

Solution: The answer is 6376663766.

We label the classrooms c1,c2,,c100c_1, c_2, \dots, c_{100}. If aia_i students are in classroom cic_i for 1i1001 \le i \le 100 at a certain step in the process, denote by (a1,a2,,a100)(a_1, a_2, \dots, a_{100}) the configuration of the students.

*Step 1:* We first show that MM is finite. Consider the function
f(a1,a2,,a100)=a12+a22++a1002. f(a_1, a_2, \dots, a_{100}) = a_1^2 + a_2^2 + \dots + a_{100}^2.
If a student walks into room aia_i from room aja_j, then we end up with the configuration (a1,a2,,ai+1,,aj1,,a100)(a_1, a_2, \dots, a_i + 1, \dots, a_j - 1, \dots, a_{100}) and
f(a1,a2,,ai+1,,aj1,,a100)f(a1,a2,,a100)=2(aiaj)+22,(41) f(a_1, a_2, \dots, a_i + 1, \dots, a_j - 1, \dots, a_{100}) - f(a_1, a_2, \dots, a_{100}) = 2(a_i - a_j) + 2 \ge 2, \quad (41)
with equality if and only if ai=aja_i = a_j. Therefore, each move increases the value of ff by at least 22.

On the other hand, it is easy to check that ff is maximized at
E=(0,,099 0’s,2010). \mathcal{E} = (\underbrace{0, \dots, 0}_{99 \text{ 0's}}, 2010).
Because ff takes only positive values, we obtain that M12f(E)M \le \frac{1}{2}f(\mathcal{E}) is finite.

*Step 2:* Consider now the configuration
B=(20,20,,2090 20’s,21,21,,2110 21’s). \mathcal{B} = (\underbrace{20, 20, \dots, 20}_{90 \text{ 20's}}, \underbrace{21, 21, \dots, 21}_{10 \text{ 21's}}).
We claim now that any configuration C\mathcal{C} may be reached from B\mathcal{B}. Indeed, start from C\mathcal{C} and perform moves in reverse. In the reverse procedure, students may move from a room to a room with at least two fewer students. Observe that each reverse move decreases the value of ff by at least 22 and that B\mathcal{B} is the only configuration where no reverse move is possible, meaning that performing a sequence of reverse moves starting at C\mathcal{C} until no more reverse moves are possible will yield B\mathcal{B}. Inverting these reverse moves yields the desired sequence of moves from B\mathcal{B} to C\mathcal{C}.

The claim implies that for any starting configuration C\mathcal{C}, any sequence of moves from C\mathcal{C} to E\mathcal{E} may be extended to a sequence of moves from B\mathcal{B} to E\mathcal{E}. Thus, to find the maximum value of MM, it suffices for us to consider sequences of moves from B\mathcal{B} to E\mathcal{E}.

*Step 3:* Consider now the special configuration
M=(0,,038 0’s,1,2,3,4,5,7,8,9,,63). \mathcal{M} = (\underbrace{0, \dots, 0}_{38 \text{ 0's}}, 1, 2, 3, 4, 5, 7, 8, 9, \dots, 63).
Note that
f(M)f(B)=(12+22++63262)(90202+10212)=44898. f(\mathcal{M}) - f(\mathcal{B}) = (1^2 + 2^2 + \dots + 63^2 - 6^2) - (90 \cdot 20^2 + 10 \cdot 21^2) = 44898.
By (41), ff increases by at least 22 at each step. Hence it takes at most m1=44898/2=22449m_1 = 44898/2 = 22449 steps to move from B\mathcal{B} to M\mathcal{M}. We claim that this maximum of m1=22449m_1 = 22449 steps can be achieved when moving from B\mathcal{B} to M\mathcal{M}. By (41), a move decreases the value of ff by exactly 22 if and only if it is between rooms with an equal number of students. Call these *good* moves. It therefore suffices to check that there exists a sequence of good moves changing B\mathcal{B} into M\mathcal{M}. For this, we use the following lemma.

Lemma 1. For positive integers 1ab1 \le a \le b, if there is a set of ba+2b-a+2 rooms with configuration (a,a+1,,c1,c,c+1,,b1,b)(a, a+1, \dots, c-1, c, c+1, \dots, b-1, b) for some acba \le c \le b, then there is a sequence of good moves which transforms these rooms into the configuration (a1,a,,d1,d+1,,b+1)(a-1, a, \dots, d-1, d+1, \dots, b+1) for d=a+bcd=a+b-c.

*Proof.* Let one of the students in a room with cc students move to the other room with cc students, then the one with c+1c+1 students, and so on, until finally he reaches the room with bb students. At this point, the configuration is (a,,c1,c1,,b1,b+1)(a, \dots, c-1, c-1, \dots, b-1, b+1). We may now repeat the procedure with the two rooms with c1c-1 students to reach the configuration (a,,c2,c2,,b2,b,b+1)(a, \dots, c-2, c-2, \dots, b-2, b, b+1). After applying this procedure ca+1c-a+1 times, we arrive at (a1,a,,d1,d+1,,b+1)(a-1, a, \dots, d-1, d+1, \dots, b+1), as desired. □

We now prove by induction that, for 1r1001 \le r \le 100, it is possible to perform a series of good moves on the first rr rooms of B\mathcal{B} so that
(a) the numbers of students in these rooms lie in a range [A,B][A, B], where 0A20<21B0 \le A \le 20 < 21 \le B, and
(b) each integer in [A,B][A, B] is represented exactly once, with the following two exceptions: Some number HH in [A,B][A, B], which we call the *hole*, does not appear, and if A=0A=0, then 00 may occur an unlimited number of times.

For the base case r=1r=1, we already have such a state with A=20,B=H=21A=20, B=H=21. To induct from r1r-1 to rr rooms, let cc be the number of students in the added room (so c=20c=20 or c=21c=21). If c=Hc=H, no moves are necessary; we may simply increase BB by 11 and set HH to the new value of BB. Otherwise, apply Lemma 1 with
a={H+1H<cmax{A,1}otherwise,b={H1H>cBotherwise,and c=c. a = \begin{cases} H+1 & H < c \\ \max\{A, 1\} & \text{otherwise,} \end{cases} \qquad b = \begin{cases} H-1 & H > c \\ B & \text{otherwise,} \end{cases} \qquad \text{and } c=c.
This yields a configuration of the desired type with H=d=a+bcH=d=a+b-c and the range [A,B][A, B] possibly expanded on one or both sides, completing the induction. It is easy to check that M\mathcal{M} is the only placement of all 20102010 students into 100100 rooms satisfying properties (a) and (b), so the final configuration in our induction is in fact M\mathcal{M}.

*Step 4:* We now claim that it takes at most m2=41317m_2 = 41317 steps to change M\mathcal{M} to E\mathcal{E}. For a configuration (a1,a2,,a100)(a_1, a_2, \dots, a_{100}), we consider the function
g(a1,a2,,a100)=1i<j100aiaj. g(a_1, a_2, \dots, a_{100}) = \sum_{1 \le i < j \le 100} |a_i - a_j|.
Note that if a student walks from cic_i to cjc_j, then aiaj|a_i - a_j| increases by 22. Furthermore, if ak>max{ai,aj}a_k > \max\{a_i, a_j\} or ak<min{ai,aj}a_k < \min\{a_i, a_j\}, then the sum akai+akaj|a_k - a_i| + |a_k - a_j| remains unchanged. On the other hand, if min{ai,aj}akmax{ai,aj}\min\{a_i, a_j\} \le a_k \le \max\{a_i, a_j\}, then the sum akai+akaj|a_k - a_i| + |a_k - a_j| increases by 22. Therefore, on each move, the value of gg increases by at least 22. We may compute g(E)=201099=198990g(\mathcal{E}) = 2010 \cdot 99 = 198990 and
g(M)=38(1+2++636)+(1++62)+(1++61)++(1+2)+1(5+4+3+2+1+1+2++57)=382010+12+22++6222+1+2++62256+57582=116356. \begin{align*} g(\mathcal{M}) &= 38 \cdot (1+2+\cdots+63-6) + (1+\cdots+62) + (1+\cdots+61) + \cdots + (1+2) + 1 \\ &\quad -(5+4+3+2+1+1+2+\cdots+57) \\ &= 38 \cdot 2010 + \frac{1^2+2^2+\cdots+62^2}{2} + \frac{1+2+\cdots+62}{2} - \frac{5 \cdot 6 + 57 \cdot 58}{2} = 116356. \end{align*}
Thus, it can take at most m2=(198990116356)/2=82634/2=41317m_2 = (198990 - 116356)/2 = 82634/2 = 41317 steps to change M\mathcal{M} to E\mathcal{E}.

*Step 5:* We show that this upper bound m2m_2 can be achieved. Indeed, if we are at a configuration (a1,,a100)(a_1, \dots, a_{100}) with 0=a1==ai<ai+1<ai+2<<a1000 = a_1 = \dots = a_i < a_{i+1} < a_{i+2} < \dots < a_{100} (configuration M\mathcal{M} satisfies this condition), we can perform the following *wave* of moves to obtain a similar configuration with one less student in ci+1c_{i+1} and one more student in room c100c_{100}:
(0,,0,ai+1,ai+2,,a100)i 0’s(0,,0,ai+11,ai+2+1,ai+2,,a100)i 0’s(0,,0,ai+11,ai+2,ai+3+1,ai+4,,a100)i 0’s(0,,0,ai+11,ai+2,ai+3,ai+4+1,ai+5,,a100)i 0’s(0,,0,ai+11,ai+2,ai+3,,a100+1)i 0’s \begin{array}{rcl} & \underbrace{(0, \dots, 0, a_{i+1}, a_{i+2}, \dots, a_{100})}_{i \text{ 0's}} & \\ \rightarrow & \underbrace{(0, \dots, 0, a_{i+1}-1, a_{i+2}+1, a_{i+2}, \dots, a_{100})}_{i \text{ 0's}} & \\ \rightarrow & \underbrace{(0, \dots, 0, a_{i+1}-1, a_{i+2}, a_{i+3}+1, a_{i+4}, \dots, a_{100})}_{i \text{ 0's}} & \\ \rightarrow & \underbrace{(0, \dots, 0, a_{i+1}-1, a_{i+2}, a_{i+3}, a_{i+4}+1, a_{i+5}, \dots, a_{100})}_{i \text{ 0's}} & \\ \rightarrow & \dots & \\ \rightarrow & \underbrace{(0, \dots, 0, a_{i+1}-1, a_{i+2}, a_{i+3}, \dots, a_{100}+1)}_{i \text{ 0's}} & \end{array}
Because of the assumption that ai<ai+1<ai+2<<a100a_i < a_{i+1} < a_{i+2} < \dots < a_{100}, it is easy to see that the value of gg increases by exactly 22 during each step in the wave. From configuration M\mathcal{M}, we can perform a sequence of waves to reach configuration E\mathcal{E}; that is, we can take exactly m2=41317m_2 = 41317 steps from M\mathcal{M} to E\mathcal{E}.

*Step 6:* We claim now that for every sequence of moves with maximum length from B\mathcal{B} to E\mathcal{E}, there is another sequence of moves of the same length which achieves configuration M\mathcal{M} along the way. Let SS be the sequence of moves of maximal length from B\mathcal{B} to E\mathcal{E} which we have just constructed; in particular, note that SS consists of good moves from B\mathcal{B} to M\mathcal{M}. Let SS' be any other maximal sequence of moves.

We claim by induction on kk that there exists a sequence SS'' of moves from B\mathcal{B} to E\mathcal{E} with the same length as SS' so that the first kk moves of SS'' and SS agree for 0km10 \le k \le m_1, where we recall that SS began with m1m_1 good moves. The base case k=0k=0 is vacuous. For the inductive step, we may assume by the inductive hypothesis that SS' and SS agree on the first kk moves. Because k<m1k < m_1, the (k+1)st(k+1)^{\text{st}} move of SS is good; suppose that it acts on two rooms cc and cc' with ss students. Observe that SS' must contain some first move mm after the first kk moves involving either cc or cc'. Without loss of generality, suppose that it involves cc. If mm is not a move between two rooms with ss students, we claim that we may lengthen SS' by adding such a move, contradicting the maximality of SS'. There are two cases.

* *Case 1:* A student leaves cc. If a student leaves cc for a room cc'' with more than ss students, we may extend SS' by having him instead take the path cccc \rightarrow c' \rightarrow c''.
* *Case 2:* A student enters cc. If a student enters cc from a room cc'' with less than ss students, we may extend SS' by instead having a different student move from cc' to cc and having the student move from cc'' to cc'.

Therefore mm must involve cc and some other room cc'' with ss students. Now, construct SS'' by removing mm, inserting it as the (k+1)st(k+1)^{\text{st}} move, and, in all moves after mm, exchanging the roles of cc' and cc''. This yields a valid sequence of moves because cc' does not play a role in any moves after the kthk^{\text{th}} move and before the original position of mm. The resulting sequence of moves SS'' has the same length as SS' and matches the first k+1k+1 moves of SS, completing the induction. Thus, we may rearrange the moves of SS' so that the first m1m_1 agree with the first m1m_1 moves of SS, producing a maximal sequence of moves which passes through M\mathcal{M}.

We conclude that all sequences of moves from B\mathcal{B} to E\mathcal{E} of maximal length have M=m1+m2=22449+41317=63766M = m_1 + m_2 = 22449 + 41317 = 63766 moves. By Step 2, this shows that the maximum value of MM is 6376663766.

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