Skip to main content
OlympiadHQ

Browse · MathNet

Print

Estonian Math Competitions

Estonia counting and probability

Problem

Juku has the first 100 volumes of the Harrie Totter book series at his home. For every and , where , call the pair reversed if volume No is before volume No on Juku's shelf. Juku wants to arrange all volumes of the series to one row on his shelf in such a way that there does not exist numbers , where , such that pairs and are both reversed. Find the largest number of reversed pairs that can occur under this condition.
Solution
Let all 100 volumes be placed to a shelf in some order. For every , let be the number of the volume that occurs as the th in this order. In the order the volumes occur on shelf , we start relocating the volumes to two new shelves and . We place a volume to the end of shelf if, as the intermediate result, all volumes on shelf would be increasingly sorted by volume numbers. Otherwise, we place the volume to the end of shelf if, as the intermediate result, all volumes on shelf would be increasingly sorted by volume numbers. Continuing this way, we either can relocate all volumes onto two shelves in such a way that all volumes on either shelf are increasingly sorted by volume numbers or get stuck on some step of the process because is less than the number of the last volume on both new shelves. In the last case, let the number of the last volume on shelf be ; then, by assumptions, and . Since volume No has been relocated to shelf , some volume with number must occur on shelf such that and . This means that pairs and were initially reversed. Hence we can conclude that, in the case of Juku's favourite orderings, all volumes can be relocated to two shelves, i.e, there exist two tuples and with , where , and , . The number of pairs such that and the numbers and are in distinct tuples is exactly . Each reversed pair must be one of these pairs. Thus the number of reversed pairs does not exceed . As , the number of reversed pairs cannot exceed 2500. The number 2500 is achieved by the order .

---

Alternative solution.

Let all 100 volumes be placed to the shelf in some order. Consider the graph whose vertices are numbers and an edge occurs between vertices and if and only if either or (depending on whether or ) is reversed. Suppose that the graph contains an odd cycle. Such cycle must contain three consecutive vertices and that are in either increasing or decreasing order; w.l.o.g., assume that . Then pairs and are both reversed. Thus under the conditions of the problem, the graph cannot contain an odd cycle. Hence the graph is bipartite. Let the numbers of vertices in the two parts be and , respectively; then the maximal number of edges is . By AM-GM, . If the volumes are in the order , exactly 2500 reversed pairs arise indeed.
Final answer
2500

Techniques

Graph TheoryColoring schemes, extremal argumentsQM-AM-GM-HM / Power MeanAlgorithms