DR.WANG Mathematics中文

BMO2 · 2024/25 · 2025-01-22 · Question 3

Counting & combinatorics · Colourings · Grid problems

Problem outline

Start with an n×nn\times n array of alternating black and white squares, with opposite colours across every shared edge. A move interchanges any two entire rows or any two entire columns. For each colouring obtainable by such moves, consider the minimum number of further moves that restore the initial colouring in its original positions. Find the maximum of these minima as a function of nn.

Show answer and methods 1 methods

Answer

The maximum is n−1n-1 for odd nn, and n/2n/2 for even nn.

Method 1 Track the original parity of each row and column

Label each row and each column by the parity of its original index. A square has its original colour exactly when its row and column labels are either both correct or both incorrect at their present positions. Thus a restored board requires every label to be correct, or every label to be reversed. Indeed, fixing just one column forces the status of every row, and a single row then forces the status of every column.

Write k=⌊n/2⌋k=\lfloor n/2\rfloor. Let rr be the number of even-labelled rows in odd positions, and define cc in the same way for columns. There are also rr odd-labelled rows in even positions. One swap fixes at most one such misplaced pair, and pairing them fixes every row in exactly rr swaps. The columns require exactly cc more, so restoring all labels costs r+cr+c, where 0≤r,c≤k0\le r,c\le k.

If n=2k+1n=2k+1, the numbers of even and odd labels differ. Reversal everywhere is impossible, so the required minimum is r+c≤2kr+c\le 2k. Swap each even row with a different odd row and likewise for columns to realise r=c=kr=c=k. This gives 2k=n−12k=n-1, also covering n=1n=1.

If n=2kn=2k, complete reversal is possible. To reach that target the corresponding costs are k−rk-r and k−ck-c, so the optimum is min⁡(r+c,2k−r−c)≤k\min(r+c,2k-r-c)\le k. Reverse the labels of all rows using kk disjoint odd-even swaps and leave the columns alone. Then r=k,c=0r=k,c=0, and both restoration choices cost k=n/2k=n/2.

Source and attribution

The outline and worked methods on this page were prepared for DR.WANG Mathematics.

Original question (external)