Maths Olympiad Prep

Library / /2 of 4

, 2020

Combinatorics Difficulty 8.3 Shortlist Prove it Belarus

The set {2,3,4,,2020}\{2, 3, 4, \ldots, 2020\} is partitioned into triples. In each triple (a,b,c)(a, b, c) the numbers were arranged in the ascending order, i.e. a<b<ca < b < c, and the difference ba+c2|b - \frac{a+c}{2}| is called the error of this triple. Find the maximal possible sum of errors of all 673673 triples.

Solution

Note that if we shift all numbers in the set by the same value, the errors will remain the same. Hence we can consider the partitions of the set {1,2,,2019}\{1, 2, \ldots, 2019\}, moreover, we will solve the generalized problem by changing 20192019 with an arbitrary number 3n3n, nNn \in \mathbb{N}.

Consider the partition of the set {1,2,,3n}\{1, 2, \ldots, 3n\}, which provides the maximal sum of all errors. Let's say that the triple a<b<ca < b < c is left if b(a+c)/2b \le (a+c)/2, otherwise let's say that it's right.

We start with the following

Step 1. Suppose the triple a<b<ca < b < c is right and bc2b \le c - 2. Choose a triple x<y<zx < y < z such that b+1{x,y,z}b+1 \in \{x, y, z\} and swap the numbers bb and b+1b+1 in these triples. Since the error of the first triple will increase by 11 and we started from the partition with the maximal sum of errors, it follows that b+1=yb+1 = y and x<y<zx < y < z is left (otherwise the sum of errors will increase). Similarly, if the triple a<b<ca < b < c is left and ab2a \le b - 2 then there exists a right triple x<b1<yx < b - 1 < y and we will swap bb and b1b-1 in these triples. We will perform such operation while it's possible. Clearly, this process is finite, since the middle numbers in the right triples increase while in the left triples they decrease and the triples doesn't change their type. The final partition will satisfy the

Property 1. Each right triple has the form a<b<b+1a < b < b+1 and each left triple has the form a<a+1<ca < a+1 < c.

Step 2. Consider any two triples x<y1<yx < y - 1 < y and a<a+1<ba < a + 1 < b of different types. The sum of errors of these two triples equals b+yax22\frac{b+y-a-x}{2} - 2.

Suppose y<ay < a. Replace these triples with x<a<a+1x < a < a+1 and y1<y<by - 1 < y < b, then the new sum of errors will become equal to b+ayx22>b+yax22\frac{b+a-y-x}{2} - 2 > \frac{b+y-a-x}{2} - 2, which contradicts the maximality of our partition. Hence a>ya > y.

Suppose b<xb < x. Replace these triples with b<y1<yb < y - 1 < y and a<a+1<xa < a + 1 < x, then the new sum of errors will become equal to y+xba22>b+yax22\frac{y+x-b-a}{2} - 2 > \frac{b+y-a-x}{2} - 2, which contradicts the maximality of our partition. Hence b>xb > x.

Consider two triples x<y1<yx < y - 1 < y and t<z1<zt < z - 1 < z of the same (without loss of generality, right) type. The sum of errors of these two triples equals z+yta22\frac{z+y-t-a}{2} - 2. Suppose y<ty < t and swap xx and tt in these triples. Then we get triples y1<y<ty - 1 < y < t and x<z1<zx < z - 1 < z of different types with their sum of errors z+txy+122>z+yta22\frac{z+t-x-y+1}{2} - 2 > \frac{z+y-t-a}{2} - 2, which contradicts the maximality of our partition. Hence y>ty > t.

Therefore the partition satisfy

Property 2. The maximal element of each triple is greater than the minimal element of any other triple.

Step 3. Suppose there exist triples x<y1<yx < y - 1 < y and a<a+1<ba < a+1 < b such that a<xa < x, and choose such triples with minimal possible xx and (for that value of xx) maximal possible aa. Consider the number a+2a+2: due to the property 2 it cannot be the maximal element of any triple and due to our choice of the pair (x,a)(x, a) it cannot be the minimal element of any triple except x<y1<yx < y - 1 < y. Thus we have found triples

a<a+1<ba < a + 1 < b and a+2<y1<ya + 2 < y - 1 < y with the sum of errors b+y2a222\frac{b+y-2a-2}{2} - 2. Consider the triples a+1<a+2<ba+1 < a+2 < b and a<y1<ya < y-1 < y: their sum of errors equals b+y2a122>b+y2a222\frac{b+y-2a-1}{2} - 2 > \frac{b+y-2a-2}{2} - 2, which contradicts the maximality of our partition. Hence x>ax > a. Replacing each number tt with 3nt3n-t we get the inequality b>yb > y. Hence we proved the final

Property 3. The minimal element of each right triple is smaller than the minimal element of each left triple. The maximal element of each left triple is greater than the maximal element of each right triple.

Combining the properties 1–3 we obtain the following description of the partition with the maximal sum of errors: there exist k,Nk, \ell \in \mathbb{N} with k+=nk + \ell = n such that the numbers 1,2,,k1, 2, \dots, k are minimal in the right triples, k+1,k+3,,k+21k+1, k+3, \dots, k+2\ell-1 are minimal in the left triples, k+2+2,k+2+4,,3k+2k+2\ell+2, k+2\ell+4, \dots, 3k+2\ell are maximal in the right triples, 3k+2+1,3k+2+1,,3k+33k+2\ell+1, 3k+2\ell+1, \dots, 3k+3\ell are maximal in the left triples. In such partition the sum of errors equals

(k+2+2)+(k+2+4)++(3k+2)12k2k++(3k+2+1)+(3k+2+2)++(3k+3)(k+1)(k+3)2(k+21)2=(k+2)k+2k(k+1)2k(k+1)22++(3k+2)+(+1)2(k1)2(+1)22k==3k(k1)+3(1)+8k4=3(k+)23(k+)+2k4=3n23n+2k4. \begin{align*} & \frac{(k+2\ell+2) + (k+2\ell+4) + \dots + (3k+2\ell) - 1 - 2 - \dots - k}{2} - k + \\ & \qquad + \frac{(3k+2\ell+1) + (3k+2\ell+2) + \dots + (3k+3\ell) - (k+1) - (k+3) - \dots}{2} \\ & \qquad \dots - \frac{(k+2\ell-1)}{2} - \ell = \frac{(k+2\ell)k + 2 \cdot \frac{k(k+1)}{2} - \frac{k(k+1)}{2}}{2} + \\ & \qquad + \frac{(3k+2\ell)\ell + \frac{\ell(\ell+1)}{2} - (k-1)\ell - 2 \cdot \frac{\ell(\ell+1)}{2}}{2} - k - \ell = \\ &= \frac{3k(k-1) + 3\ell(\ell-1) + 8k\ell}{4} = \frac{3(k+\ell)^2 - 3(k+\ell) + 2k\ell}{4} = \frac{3n^2 - 3n + 2k\ell}{4}. \end{align*}

The expression 2k=2k(nk)2k\ell = 2k(n-k) attains its maximal value at k=n2k = \left\lfloor \frac{n}{2} \right\rfloor, hence we get the answer

3n23n+2n2n24. \frac{3n^2 - 3n + 2 \lfloor \frac{n}{2} \rfloor \lfloor \frac{n}{2} \rfloor}{4}.

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.