Let $S$ be the set of lattice points whose both coordinates are positive integers no larger than $2022$. i.e., $S=\{(x, y) \mid x, y\in \mathbb{N}, \, 1\leq x, y\leq 2022\}$. We put a card with one gold side and one black side on each point in $S$. We call a rectangle "good" if: (i) All of its sides are parallel to the axes and have positive integer coordinates no larger than $2022$. (ii) The cards on its top-left and bottom-right corners are showing gold, and the cards on its top-right and bottom-left corners are showing black. Each "move" consists of choosing a good rectangle and flipping all cards simultaneously on its four corners. Find the maximum possible number of moves one can perform, or show that one can perform infinitely many moves. Proposed by CSJL
Problem
Source: 2022 IRN TWN Friendly Math Competition P5
Tags: Taiwan, Iran, combinatorics, Operations
24.06.2022 00:57
The answer is $1011^4$. In general, for $m$ rows and $n$ columns, the answer is $$\lfloor \frac{m^2}{4}\rfloor \lfloor \frac{n^2}{4}\rfloor$$ Construction: let $k=\lfloor \frac m2 \rfloor$ and $l=\lfloor \frac n2\rfloor$. Color $(x,y)$ gold iff both or none of $x\le k$ and $y\le l$ holds. We can check after this many moves, we can reach a position where $(x,y)$ is gold iff both or none of $x\le m-k$ and $y\le n-l$ holds. Proof of optimality: let $$S_j=\sum\limits_{(i,j) \text{ black}} i$$Be the "inversion index" for row $j$. Note the sum of $S_j$ is an invariant. We can replace $S_j\rightarrow S_j-c_j$ such that $S_j$ is an integer between 0 and $X$ where $X=\lfloor \frac{m^2}{4}\rfloor$ Consider an alternative process where each move, we increment $S_j$ by $c$ and decrement $S_t$ by $c$ for some $j<t, c\ge 1$ and I get $(t-j)c$ points. It's clear each move gives me at least one point, so it suffices to show that number of points I can earn is at most $X \lfloor \frac{n^2}{4}\rfloor$ WLOG I always decrement $S_j$ and increment $S_{j+1}$. We can see for each $1\le j\le l$ I can score at most $jX$ points by decrementing $S_j$ and incrementing $S_{j+1}$ because it can lose $(j-1)X$ total index from lower rows and $X$ points from this row. Similarly I can score at most $(n-j)X$ points by incrementing $S_j$ and decrementing $S_{j+1}$. Summing, my score (number of points) is at most $X(1+2+\cdots+l+l+\cdots+1)$ for $n$ odd and $X(1+2+\cdots+l+\cdots+1)$ for $n$ even, yields the desired result.