Skip to main content

2026 AIME I Problem 11

Problem 11 of 15HarderAlgebraProblem-Solving Techniques

The integers from 11 to 6464 are placed in some order into an 8×88 \times 8 grid of cells with one number in each cell. Let ai,ja_{i,j} be the number placed in the cell in row ii and column j,j, and let MM be the sum of the absolute differences between adjacent cells. That is, M=∑i=18∑j=17(∣ai,j+1−ai,j∣+∣aj+1,i−aj,i∣). \begin{aligned} M = \sum_{i=1}^{8} \sum_{j=1}^{7} \big(&|a_{i,j+1} - a_{i,j}| \\ &{}+ |a_{j+1,i} - a_{j,i}|\big). \end{aligned} Find the remainder when the maximum possible value of MM is divided by 1000.1000.

Your answer

Integer from 0 to 999
Show solution

Solution

View the grid as a graph whose 112112 edges join adjacent cells. Each edge contributes its larger endpoint value positively and its smaller one negatively, so M=∑vcvav,M = \sum_v c_v a_v, where ava_v is the entry in cell vv and cvc_v is the number of neighbors of vv with smaller entries minus the number with larger entries. Then ∣cv∣≤deg⁡(v),|c_v| \le \deg(v), which is 44 for the 3636 interior cells, 33 for the 2424 edge cells, and 22 for the 44 corners, and ∑vcv=0\sum_v c_v = 0 since each edge contributes +1+1 and −1.-1. Because ∑vcv=0,\sum_v c_v = 0, M=∑vcv(av−652)≤∑vdeg⁡(v)∣av−652∣. \begin{aligned} M &= \sum_v c_v \left(a_v - \tfrac{65}{2}\right) \\ &\le \sum_v \deg(v)\left|a_v - \tfrac{65}{2}\right|. \end{aligned} By the rearrangement inequality this is maximized by pairing the 3636 values farthest from 652\frac{65}{2} (namely 11–1818 and 4747–64,64, whose deviations total 828828) with the interior cells, the next 2424 values (1919–3030 and 3535–46,46, totaling 192192) with the edge cells, and 3131–3434 (totaling 44) with the corners. Hence M≤4⋅828+3⋅192+2⋅4M \le 4 \cdot 828 + 3 \cdot 192 + 2 \cdot 4 =3896.= 3896. Equality requires every cell holding a value at most 3232 to be smaller than all its neighbors and every value at least 3333 to be larger, which a checkerboard achieves: put 11–3232 on the black cells (11–1818 on interior blacks, 1919–3030 on edge blacks, 3131–3232 on black corners) and 3333–6464 on the white cells (3333–3434 on corners, 3535–4646 on edges, 4747–6464 in the interior). Every neighbor pair then compares white over black, so M=3896,M = 3896, and the answer is 3896 mod 1000=896.3896 \bmod 1000 = 896.
AoPS wiki

Tagged: optimization · absolute value · extremal argument

More practice