Maths Olympiad Prep

Library / /29 of 29

Combinatorics Difficulty 7.3 National Olympiad, round 2 Prove it Croatia

Let MM and NN be positive integers. Consider an N×NN \times N square array consisting of N2N^2 lamps that can be in two states - on or off. At the beginning all lamps are turned off.
A move consists of choosing a row or a column of the array and changing the state of MM consecutive lamps in the chosen row or column, i.e. turning on the lamps that are turned off and vice versa.
Determine the necessary and sufficient condition for which it can be achieved that after a finite number of moves all lamps are turned on. (Tonći Kokan)

Solution

The sought condition is that MM divides NN.

It is easy to see that if MM divides NN we can choose a sequence of moves after which all lamps will be turned on. Really, if N=MkN = Mk for some positive integer kk then we choose each row kk times. In the (ik+j)(ik+j)-th move, for i=0,1,,M1i = 0, 1, \dots, M-1, j=1,,kj = 1, \dots, k we choose MM consecutive lamps from ((j1)k+1)((j-1)k+1)-th to jkjk-th place in (i+1)(i+1)-th row.

To prove necessity, colour the lamps in MM colors (named 0,1,2,,M10, 1, 2, \dots, M-1) in a way presented on the Figure 4.1, i.e. color the lamp in the ii-th row and jj-th column in color i+j2i + j - 2 (mod MM).

Figure 1
Figure 4.1: Example of the coloring for N=10,M=6N = 10, M = 6.

In every move we change the state of exactly one lamp of each color. In the beginning all lamps are turned off so after each step we have the same number of lamps that are turned on in all colors. If it is possible to achieve that after some move all lamps are turned on, then the number of lamps of each color must be the same.

Assume on the contrary that MM does not divide NN and let N=Mk+rN = Mk + r, where 1rM11 \le r \le M-1. Divide the N×NN \times N array into four subarrays of dimensions Mk×Mk,Mk×r,r×MkMk \times Mk, Mk \times r, r \times Mk and r×rr \times r as in the Figure 4.2.
Since each of the subarrays of dimensions Mk×Mk,Mk×rMk \times Mk, Mk \times r and r×Mkr \times Mk is a disjoint union of sequences of MM consecutive lamps in a row or a column, we see that the number of lamps of each color in their union is the same (it equals Mk2+2krMk^2 + 2kr).

---

Figure 2
Figure 4.2: Dividing the array for N=10N = 10, M=6M = 6.

Consider the remaining r×rr \times r subarray. On Figure 4.3 we see that the number of lamps of color r1r-1 equals rr, but the number of lamps of color rr equals r1r-1. Indeed, the lamps of color r1r-1 appear in each row of the subarray exactly once and the lamps of color rr appear in each but first row. Also, there is no row with two or more lamps of color rr because rr is strictly less than MM so each row has all the lamps of different color.

Figure 3
Figure 4.3: Example of the r×rr \times r subarray for N=10N = 10, M=6M = 6 (and r=4r = 4).

Hence in the whole array we have a different number of lamps of color r1r-1 and color rr and we can never achieve that all of the lamps are turned on.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.