The integers from 1 to 64 are placed in some order into an 8Γ8 grid of cells with one number in each cell. Let ai,jβ be the number placed in the cell in row i and column j, and let M be the sum of the absolute differences between adjacent cells. That is,
M=i=1β8βj=1β7β(β£ai,j+1ββai,jββ£+β£aj+1,iββaj,iββ£).
Find the remainder when the maximum possible value of M is divided by 1000.
Announcement
Random Math Together Program - Free for USA(J)MO Qualifiers
Our together program brings together high-achieving students nationwide for team-based problem solving and to prepare for competitions such as HMMT, PUMaC, and more.
Eligibility: USA(J)MO qualifiers β’ Spots limited
Consider a checkerboard coloring of the 8Γ8 grid of cells resulting in 32 white and 32 black cells. Consider an assignment involving placing the 32 larger numbers (33β64) on the black cells and the 32 smaller numbers 1β32 on the white cells.
Under this arrangement, note that some cells get counted more times than other cells. For example cells on the outer ring of the board get counted 2 or 3 times, but cells on the interior get counted 4 times. So for the black cells, we place larger numbers on the cells that are counted more times and smaller numbers on the cells that are counted less. We do a similar process for the white cells but flipped (smaller when counted more and larger when counted less).
For each color, there are 2 cells counted twice, 12 cells counted 3 times and 18 cells counted 4 times. Thus, the best we can achieve with this construction is
4(47+48+β―+64)+3(35+36+β¦46)+2(33+34)
β4(1+2+β―+18)β3(19+36+β¦30)β2(31+32)
Summing cleverly: 4β
46β
18+3β
16β
12+2β
2β
2=3896β.
Now, we show that this is in fact the maximum we can possibly make a sum. Consider the final sum, after we have flipped all the absolute value signs (turned β£aβbβ£ into bβa if a<b and aβb otherwise.
Let xiβ for 1β€iβ€112 be the positive terms and yiβ defined similarly for the negative terms. The sum is now:
i=1β112βxiββi=1β112βyiβ=i=1β112β(xiββ32.5)+i=1β112β(32.5βyiβ)
Now, note that in this new sum, each appearance of any number n from {1,2,3,β¦64} contributes either β£nβ32.5β£ or ββ£nβ32.5β£. We will assume, for the purposes of bounding, that a number contributes β£nβ32.5β£ as this only increases the sum. Taking into account that 36 numbers are counted 4 times, 24 are counted 3 times, and 4 are counted twice, we assign numbers with larger values of β£nβ32.5β£ to larger multiplicities by rearrangement inequality. The 36 largest values of β£nβ32.5β£ are when n is on the range [1,18] or [47,64], the next 24 larger values are when n is on the range [19,30] or [35,46] and the remaining 4 values are assigned to a multiplicity of 2. Clearly, this gives us the same sum as the one we computed above, so our answer is the maximum.
Solution 2:
Let V be the set of cells in the grid, and E represent the number of edges in the grid connecting cells, where each edge is labeled with the weight wu,vβ=β£uβvβ£ (where the edge wu,vβ is the edge connecting the cells with u and v). Denote each edge in E connecting cells with u and v as (u,v), with u<v.
Our goal is to find
(u,v)βEββwu,vβ=(u,v)βEββt=1βwu,vββ1=t=1β63β(number of edges (u,v) of E with uβ€t<v)
Define Vtβ to be the set of cells in V labelled with a number at most t. Then, the number of edges (u,v) of E with u<v is simply the number of edges between Vtβ and VβVtβ (we will denote this as E(Vtβ)).
Consider some arbitrary set SβV with β£Sβ£β€32. We claim that E(S)=E(VβS) is maxmimized when S has no internal edges.
Note that we can say that for each vertex vβS, each edge goes either to another vertex in S, or a vertex in VβS. Thus, all vertices from S that do not go to VβS must go to another vertex in S, hence
E(S)β=vβSββnumber of edges from v to VβS=vβSββnumber of edges from vβnumber of edges from v to S=vβSββdeg(v)β2β
β£internal edges of Sβ£β
as each internal edge will be double counted, one for each endpoint in S. But note that 4β₯deg(v)β₯2 for all vβV.
We claim one possible maxima of this is given by the following construction: color the squares in a checkerboard fashion, and call a square "corner" if it has degree 2, "edge" if it has degree 3, and "center" if it has degree 4. Then,
- If β£Sβ£β€18, we choose β£Sβ£ the black squares in the center.
- If 19β€β£Sβ£β€30, we choose 18 black squares in the center, and 30ββ£Sβ£ black squares on the edge.
- If β£Sβ£β₯31, we choose the 18 black center squares, 12 black edge squares, and the remaining 32ββ£Sβ£ black corner squares.
Note that this is just a greedy algorithm. If we have k>18 center squares, imagine tiling the inner 6Γ6 central grid with dominoes. Since we have 18 dominoes, the Pigeonhole Principle tells us that at least kβ18 domino pairs exist. This means that for every increase in degree we introduce (which is a maximum of 2 to 4), we also increase the number of internal edges by at least 1, hence our sum increases by at most (4β2)β2β
1=0 (with a similar idea if we have more than 12 edge squares). Thus indeed we get an optimal value of E(S) whenever S has no internal edges.
This means that the optimal solution is when S1ββS2βββ―βS32β has no internal edges, so thus the 32 lowest numbers must be one color (assume black) of the checkerboard (note that this maximizes E(Vtβ) for tβ€32). This would mean the highest 32 numbers would be the other color (white), and this maximizes E(Vtβ)=E(VβVtβ) for tβ₯32 (VβVtβ is the highest t numbers). Thus, our sum is maximized with this checkerboard.
Our checkerboard pattern means that all edges are weighed with the value
wu,vβ=value of black cellβvalue of white cell
Note that there are 18 black (center) cells that have degree 4, 12 with degree 3, and 2 with degree 2 (and the same for white cells). By the rearrangement inequality, we want our largest black (and smallest white) to be center cells, and the smallest black and largest white on the corners. Thus, the maximum possible sum is
4k=47β64βk+3k=35β46βk+2k=33β34βkβ2k=31β32βkβ3k=19β30βkβ4k=1β18βk=3896
for an answer of 896β.
The problems on this page are the property of the MAA's American Mathematics Competitions