Skip to main content

AMC 12 Mock Exam 10 Problem 17

Problem 17 of 25

Ten houses stand along a straight road at mile markers 1,2,3,…,101,2,3,\ldots,10, and the house at mile marker kk has exactly kk children. The town will place two school-bus stops at points on the road, and each child walks along the road to whichever stop is nearer to his or her house. The stops are placed so that the total walking distance of all 5555 children is as small as possible. What is that total distance, in miles?

Answer choices

Show solution

Solution

Reduction. With stops at x≤yx\le y, the houses nearer xx form an initial block {1,…,j}\{1,\dots,j\} and the rest form {j+1,…,10}\{j+1,\dots,10\}. Conversely, for any split, putting one stop at the best point for each block makes every child walk at most the distance to the stop of their block. So the answer is min⁡j(F(1..j)+F(j+1..10))\min_j\big(F(1..j)+F(j{+}1..10)\big), where F(S)F(S) is the least value of ∑k∈Sk ∣s−k∣\sum_{k\in S}k\,|s-k| over real ss.

One stop. ∑k∈Sk ∣s−k∣\sum_{k\in S} k\,|s-k| is piecewise linear in ss; moving ss to the right increases it at rate (weight to the left of ss) −- (weight to the right), so it is minimized at a weighted median: the first house where the running total of weights reaches half the block's total.

The splits. For example, for j=6j=6 the left block has weight 2121 and median 55, with cost 4+6+6+4+0+6=264+6+6+4+0+6=26; the right block {7,8,9,10}\{7,8,9,10\} has weight 3434 and median 99, with cost 14+8+0+10=3214+8+0+10=32. The total is 5858. Doing the same for every jj: j123456789total1069583716358586782\begin{array}{c|ccccccccc} j&1&2&3&4&5&6&7&8&9\\\hline \text{total}&106&95&83&71&63&58&58&67&82 \end{array} For j=7j=7 the block {1,…,7}\{1,\dots,7\} costs 4040 (stop at 55) and {8,9,10}\{8,9,10\} costs 1818 (stop at 99). The minimum is 58\boxed{58}. (A single stop at the weighted median 77 gives 112112; splitting the houses five and five gives 6363; the splits j=8j=8 and j=4j=4 give 6767 and 7171.)

Tagged: minimizing a weighted sum of distances (two weighted medians)