Olympiad Maths Prep

Track / Stage 5 / 350 of 400 #950 of 2000

Problem 950

AIME late
Combinatorics Difficulty 5.9 Find the answer

The ninety-ninth problem: Given an odd number n3\mathrm{n} \geq 3, color each cell of an n×n\mathrm{n} \times \mathrm{n} grid using two colors, black and white. Two cells with the same color that share a vertex are called "adjacent." For any two cells aa and bb, if there exists a sequence of cells c1,c2,,ckc_{1}, c_{2}, \ldots, c_{k} such that c1=a,ck=bc_{1}=a, c_{k}=b, and ci(i=1,2,,k1)c_{i}(i=1, 2, \ldots, k-1) is adjacent to ci+1c_{i+1}, then aa and bb are said to be "connected." Find the largest positive integer MM such that there exists a coloring scheme where there are MM cells that are pairwise not connected.

Official solution

The 99th problem:
Solution: Consider the generalized problem.
For an m×n\mathrm{m} \times \mathrm{n} grid, where m\mathrm{m} and n\mathrm{n} are both odd numbers not less than 3, color the grid in black and white. In a given coloring scheme, all cells can be divided into several connected components, such that cells within the same connected component are connected to each other, and cells in different connected components are not connected. The number of connected components is denoted as K\mathrm{K}.
We will prove the following using mathematical induction:
(1) K(m+1)(n+1)4+1K \leq \frac{(m+1)(n+1)}{4}+1;
(2) When K=(m+1)(n+1)4+1K=\frac{(m+1)(n+1)}{4}+1, each cell at the four corners of the grid is not connected to any other cell.
When m=n=3\mathrm{m}=\mathrm{n}=3, the eight cells on the outermost perimeter can belong to at most four connected components of a different color from the central cell, so K5\mathrm{K} \leq 5. The equality holds if and only if the cells at the four corners are of a different color from the other five cells.

Next, assume m5m \geq 5. Let the second row from left to right form k\mathrm{k} alternating black and white segments: A1, A2,,Ak\mathrm{A}_{1}, \mathrm{~A}_{2}, \ldots, A_{k}, with the number of cells in each segment being x1,x2,,xkx_{1}, x_{2}, \ldots, x_{k}. Let PP be the number of connected components that contain cells from the first row but not from the second row.
We now estimate PP.
If k2\mathrm{k} \geq 2, the last cell of A1\mathrm{A}_{1} is the same color as either the last cell of A1\mathrm{A}_{1} or the first cell of A2\mathrm{A}_{2}, thus it is connected to a cell in the second row; among the first x11x_{1}-1 cells, at most x112\left\lceil\frac{x_{1}-1}{2}\right\rceil cells are of a different color from A1\mathrm{A}_{1} and are not connected to each other. Similarly, among the cells above Ak\mathrm{A}_{k}, at most xk12\left\lceil\frac{x_{k}-1}{2}\right\rceil cells are of a different color from the second row and are not connected to each other.

For 1<i<k1<\mathrm{i}<\mathrm{k}, among the xi2\mathrm{x}_{\mathrm{i}}-2 cells in the middle of Ai\mathrm{A}_{\mathrm{i}}, at most xi22\left\lceil\frac{\mathrm{x}_{\mathrm{i}}-2}{2}\right\rceil cells are of a different color from Ai\mathrm{A}_{\mathrm{i}} and are not connected to each other.
Thus, Px112+xk12+i=2k1xi22nk+22P \leq\left\lceil\frac{x_{1}-1}{2}\right\rceil+\left\lceil\frac{x_{k}-1}{2}\right\rceil+\sum_{i=2}^{k-1}\left\lceil\frac{x_{i}-2}{2}\right\rceil \leq \frac{n-k+2}{2}.
If k=1\mathrm{k}=1, then Pn2nk+22\mathrm{P} \leq\left\lceil\frac{\mathrm{n}}{2}\right\rceil \leq \frac{\mathrm{n}-\mathrm{k}+2}{2}.
Let QQ be the number of connected components that contain cells from the second row but not from the third row. Since Ai\mathrm{A}_{\mathrm{i}} and Ai+1\mathrm{A}_{\mathrm{i}+1} always have one segment connected to the third row (consider the last cell of Ai\mathrm{A}_{\mathrm{i}} and the first cell of Ai+1\mathrm{A}_{\mathrm{i}+1}, one of them must be connected to the third row), we have Qk2k+12Q \leq\left\lceil\frac{k}{2}\right\rceil \leq \frac{k+1}{2}.
Let RR be the number of connected components that contain cells from the third to the mm-th row. According to the induction hypothesis (1), we have R(m1)(n+1)4+1R \leq \frac{(m-1)(n+1)}{4}+1.
We now prove: If Q=k+12Q=\frac{k+1}{2} (for odd kk) or Q=k2Q=\frac{k}{2} (for even kk), then R(m1)(n+1)4R \leq \frac{(m-1)(n+1)}{4}.
In fact, when kk is odd and Q=k+12Q=\frac{k+1}{2}, if k=1k=1, then Q=1Q=1, all cells in the second row are the same color, and all cells in the third row are also the same color. By the induction hypothesis (2), we have R(m1)(n+1)4R \leq \frac{(m-1)(n+1)}{4}.

If kk is an odd number and k3k \geq 3, let the cells below Ai\mathrm{A}_{\mathrm{i}} be Bi\mathrm{B}_{\mathrm{i}}. Since A1,A3,,Ak\mathrm{A}_{1}, \mathrm{A}_{3}, \ldots, \mathrm{A}_{k} are not connected to the third row, B1,B3,,Bk\mathrm{B}_{1}, \mathrm{B}_{3}, \ldots, \mathrm{B}_{k} are of a different color from A1,A3,,Ak\mathrm{A}_{1}, \mathrm{A}_{3}, \ldots, \mathrm{A}_{k}, and thus are the same color as A2,A4,,Ak1\mathrm{A}_{2}, \mathrm{A}_{4}, \ldots, \mathrm{A}_{k-1}. Therefore, B1,A2,B3,A4,B5,,Ak1,Bk\mathrm{B}_{1}, \mathrm{A}_{2}, \mathrm{B}_{3}, \mathrm{A}_{4}, \mathrm{B}_{5}, \ldots, \mathrm{A}_{k-1}, \mathrm{B}_{k} are all connected. By the induction hypothesis (2), we have R(m1)(n+1)4R \leq \frac{(m-1)(n+1)}{4}.

When kk is even and Q=k2Q=\frac{k}{2}, if R=(m1)(n+1)4+1R=\frac{(m-1)(n+1)}{4}+1, then by the induction hypothesis (2), the first cell in the third row is of a different color from the second cell. Thus, A1\mathrm{A}_{1} is connected to the third row. Similarly, Ak\mathrm{A}_{\mathrm{k}} is also connected to the third row. Therefore, among A2,A3,,Ak1\mathrm{A}_{2}, \mathrm{A}_{3}, \ldots, \mathrm{A}_{k-1}, at most k22\frac{k-2}{2} segments are not connected to the third row. Hence, Qk22Q \leq \frac{k-2}{2}, which contradicts the assumption that Q=k2\mathrm{Q}=\frac{\mathrm{k}}{2}.
Therefore, when Q=k2Q=\left\lceil\frac{k}{2}\right\rceil, we have R(m1)(n+1)4R \leq \frac{(m-1)(n+1)}{4}. Thus, we have:
K=P+Q+Rnk+22+k+12+(m1)(n+1)4=(m+1)(n+1)4+1K=P+Q+R \leq \frac{n-k+2}{2}+\frac{k+1}{2}+\frac{(m-1)(n+1)}{4}=\frac{(m+1)(n+1)}{4}+1

When the equality holds, kk must be odd, and P=nk+22P=\frac{n-k+2}{2}.
Considering the condition for the equality in the estimation of P\mathrm{P}, we know that the first and last cells of the first row are each surrounded by three cells of a different color. By the symmetry of the grid, we know that each cell at the four corners is not connected to any other cell.

Finally, it is easy to verify that for the cell at the ii-th row and jj-th column, if ijij is even, color it black; if ijij is odd, color it white. In these two coloring schemes, we have K=(m+1)(n+1)4+1K=\frac{(m+1)(n+1)}{4}+1.
In summary, the required M=(n+1)24+1M=\frac{(\mathrm{n}+1)^{2}}{4}+1.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.