In some squares of a grid there are some beetles, such that no square contain more than one beetle. At one moment, all the beetles fly off the grid and then land on the grid again, also satisfying the condition that there is at most one beetle standing in each square. The vector from the centre of the square from which a beetle flies to the centre of the square on which it lands is called the [i]translation vector[/i] of beetle .
For all possible starting and ending configurations, find the maximum length of the sum of the [i]translation vectors[/i] of all beetles.
Solution
In a grid, we place beetles such that no square contains more than one beetle. When the beetles fly off and land again, each beetle has a translation vector from its initial to its final position. We aim to find the maximum length of the sum of these translation vectors for all possible starting and ending configurations.
The answer is , which is achieved by moving beetles that start on the left half of the grid each units to the right. We now prove that this is maximal.
Suppose the beetles start at positions and end at positions , and let denote the center of the board. By the triangle inequality,
We will prove that . This will be done by applying the triangle inequality smartly.
Assume and scale the board so that the gridlines are of the form and for integers . The closest square centers to are . For , consider the set of points such that , which forms a square-shaped "frame".
Define , where . We claim that
To prove this, we observe the following "smoothing"-type facts:
- If contains two opposite points of the form and , we can delete both without changing anything.
- If does not contain nor , then one of them must form a non-obtuse angle with , so adding that one to will increase .
- If contains some which forms an obtuse angle with , then removing it from will increase .
Hence, if is maximal, we must have , and the range of the arguments of the vectors formed by elements of is at most . It cannot be exactly by the first property. Thus, must be formed from a contiguous run of points along the frame.
The rest of the problem is essentially algebraic. We only consider which satisfy the above requirements, meaning that some entire "side" of the frame must be contained in . Without loss of generality, assume the right side (). Suppose the rightmost point on the top side has -coordinate , so the rightmost point on the bottom side has -coordinate (where ).
In this case, the -component of equals
The -component of is
Therefore, if , we have
Because , , so
thus,
which is the desired bound.
To finish, by summing our bound over , we have
Remembering that we scaled by a factor of , this implies that we actually have , which is the desired result.
The answer is .