Maths Olympiad Prep

Library / /28 of 36

Combinatorics Difficulty 6.8 National Olympiad Prove it Netherlands

Eva looks at “words” consisting of nn characters, each equal to ‘L’ or ‘R’. In one turn, Eva may replace ‘RL’ anywhere in the word with ‘LR’. For example, in two turns, she takes the word ‘LRRLRRRLR’ to the word ‘LRLRRRLRR’. If there is no ‘L’ immediately to the right of an ‘R’, Eve cannot make a turn.

a. Eva has such a word of length nn. Prove that Eva can only make a finite number of turns.

b. Given n>1n > 1 and \ell with 0<<n0 < \ell < n. For every word of length nn with exactly \ell times an ‘L’ Eva writes down how many turns she can take at most. What is the biggest number she wrote down? (Give your answer in terms of nn and \ell.)

*Prove that your answer is correct. This means: give a word of length nn with exactly \ell times the character 'L' for which the maximum number of turns is achieved and prove that the maximum number of turns for all other words of length nn with exactly ll times the character 'L' cannot be greater.*

c. Let n2n \ge 2. For every word of length nn (with 1 or more times an 'L' and 1 or more times an 'R') Eva writes down how many turns she can take at most. How many characters 'L' contains the word (or words) for which she has written down the biggest number? (Give your answer in terms of nn.)

Solution

a. Add up the positions of the characters 'L', where the leftmost character in the word has position 1 and the rightmost character has position nn. We call this number the L-sum of a word. For each word, the L-sum is a non-negative integer. Furthermore, for every move Eva makes, the L-sum becomes one lower. Indeed, when switching 'L' and 'R', the position of the 'L' that Eva switches becomes one lower. Therefore, since the L-sum cannot become negative, Eva can always do only a finite number of turns.

b. Of all the possible words of length nn that Eva considers, the L-sum is the largest with the word 'RR...RL...LL', where all \ell characters 'L' are on the right side of the word. On the contrary, the L-sum is smallest for the word 'LL...LRR...R', where all \ell characters 'L' are on the left side of the word. In this word, Eva cannot do any more turns, because there is nowhere an 'L' directly to the right of an 'R'. To compute the difference in L-sums, note that the left-most 'L' in 'RR...RL...LL' and the left-most 'L' in 'L...LRR...R' differ nn - \ell from each other in position. The same is true for all subsequent characters 'L', from left to right. Thus, the difference in L-sum between these two words is (n)\ell(n - \ell). We already saw that the L-sum of a word becomes exactly one smaller at each turn: an upper bound on the maximum number of turns is thus (n)\ell(n - \ell).

Eva can also actually do (n)\ell(n - \ell) turns if she starts with the word 'RR...RL...LL'. For the first nn - \ell turns, she uses only the leftmost 'L', and the result is the word 'LRR...RL...LL' with 1\ell - 1 times an 'L' on the right side. Next, she chooses the second 'L' from the left, and in nn - \ell turns she makes the word 'LLRR...RL...LL' with 2\ell - 2 times an 'L' on the right side. Eva does this with all \ell the characters 'L'. In total, she can take (n)\ell(n - \ell) turns before she ends with 'L...LRR...R'.

c. In the previous part of the problem, we already saw that Eva can do at most (n)\ell(n - \ell) turns. Consider the function f()=(n)f(\ell) = \ell(n - \ell). This is a quadratic function with zeros at =0\ell = 0 and =n\ell = n. So the maximum is at =12n\ell = \frac{1}{2}n. If nn is even, then Eva can do as many turns as possible at =n2\ell = \frac{n}{2}. (The number of turns is then f(n2)=14n2f(\frac{n}{2}) = \frac{1}{4}n^2.) If nn is odd, the maximum of this function is not at an integer value of \ell and we see that Eva can do as many turns as possible at =n12\ell = \frac{n-1}{2} and =n+12\ell = \frac{n+1}{2}. (The number of turns is then f(n12)=f(n+12)=14(n21)f(\frac{n-1}{2}) = f(\frac{n+1}{2}) = \frac{1}{4}(n^2 - 1).)

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.