Let be a positive integer. The organising committee of a tennis tournament is to schedule the matches for players so that every two players play once, each day exactly one match is played, and each player arrives to the tournament site the day of his first match, and departs the day of his last match. For every day a player is present on the tournament, the committee has to pay 1 coin to the hotel. The organisers want to design the schedule so as to minimise the total cost of all players' stays. Determine this minimum cost.
Problem 1960
Official solutions — 2
Solution 1
Enumerate the days of the tournament . Let be the days the players arrive to the tournament, arranged in nondecreasing order; similarly, let be the days they depart arranged in nonincreasing order (it may happen that a player arrives on day and departs on day , where ). If a player arrives on day and departs on day , then his stay cost is . Therefore, the total stay cost is
Bounding the total cost from below. To this end, estimate . Before day , only players were present, so at most matches could be played. Therefore, . Similarly, at most matches could be played after day , so . Thus,
This lower bound can be improved for : List the players who arrived first, and the players who departed last; at least players appear in both lists. The matches between these players were counted twice, though the players in each pair have played only once. Therefore, if , then
An optimal tournament. We now describe a schedule in which the lower bounds above are all achieved simultaneously. Split players into two groups and , each of cardinality . Next, partition the schedule into three parts. During the first part, the players from arrive one by one, and each newly arrived player immediately plays with everyone already present. During the third part (after all players from have already departed) the players from depart one by one, each playing with everyone still present just before departing.
In the middle part, everyone from should play with everyone from . Let be the players in , and let be the players in . Let arrive in this order; after arrives, he immediately plays with all the . Afterwards, players , depart in this order; each plays with all the , just before his departure, and departs the day arrives. For , the number of matches played between 's arrival and 's departure is
Thus, if , then the number of matches that have been played between 's arrival, which is , and 's departure, which is , is ; that is, , showing the second lower bound achieved for all .
If , then the matches between the players present before all fall in the first part of the schedule, so there are such, and . Similarly, after , there are players left, all matches now fall in the third part of the schedule, and . The first lower bound is therefore also achieved for all .
Consequently, all lower bounds are achieved simultaneously, and the schedule is indeed optimal.
Evaluation. Finally, evaluate the total cost for the optimal schedule:
\begin{aligned}
\Sigma & =\sum_{i=0}^{k}(k(2k-1)-i(i-1))+\sum_{i=k+1}^{2k-1}(2k-i)^{2}=(k+1)k(2k-1)-\sum_{i=0}^{k} i(i-1)+\sum_{j=1}^{k-1} j^{2} \\
& =k(k+1)(2k-1)-k^{2}+\frac{1}{2}k(k+1)=\frac{1}{2}k\left(4k^{2}+k-1\right)
\end{aligned}
Solution 2
Consider any tournament schedule. Label players in order of their arrival, and label them again in order of their departure, to define a permutation of by .
We first describe an optimal tournament for any given permutation of the indices . Next, we find an optimal permutation and an optimal tournament.
Optimisation for a fixed . We say that the cost of the match between and is the number of players present at the tournament when this match is played. Clearly, the Committee pays for each day the cost of the match of that day. Hence, we are to minimise the total cost of all matches.
Notice that 's departure does not precede 's arrival. Hence, the number of players at the tournament monotonically increases (non-strictly) until it reaches , and then monotonically decreases (non-strictly). So, the best time to schedule the match between and is either when arrives, or when departs, in which case the cost is .
Conversely, assuming that , if this match is scheduled between the arrivals of and , then its cost will be exactly . Similarly, one can make it cost . Obviously, these conditions can all be simultaneously satisfied, so the minimal cost for a fixed sequence is
Optimising the sequence . Optimisation hinges on the lemma below.
Lemma. If and , then
Proof. Write and and check that .
Consider a permutation such that for some . Swapping and does not change the th summand in (1), and for the sum of the th and the th summands does not increase by the Lemma. Hence the optimal value does not increase, but the number of disorders in the permutation increases. This process stops when for all , so the required minimum is
The latter sum is fairly tractable and yields the stated result; we omit the details.