Bogdanov I.I.

In a $2005 \times 2006$ table, numbers $0,1,2$ are arranged such that the sum of the numbers in each column and each row is divisible by 3.

What is the maximum possible number of ones that can be in this table?

#
Evaluation. Let there be $n$ zeros and $d$ twos in the table. We have 2005 rows of length 2006 and 2006 columns of length 2005. For the sum in a row to be divisible by 3, there must be at least one two or two zeros. Hence, $d + n / 2 \geq 2005$. Similarly, in each column, there must be at least one zero or two twos, so $n + d / 2 \geq 2006$. Adding these inequalities, we get $n + d \geq 2674$, meaning there are at least 2674 non-ones in the table.

Example. This result is achieved in the table provided (1338 zeros in the upper left rectangle $669 \times 1338$ and 1336 twos in the lower right rectangle $1336 \times 668$).

| $\mathbf{0}$ | $\mathbf{0}$ | $\mathbf{1}$ | $\mathbf{1}$ | $\ldots$ | $\ldots$ | 1 | 1 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| $\mathbf{1}$ | 1 | $\mathbf{0}$ | $\mathbf{0}$ | $\ldots$ | $\ldots$ | 1 | 1 |
| $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ |
| $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ | $\ldots$ |
| 1 | 1 | 1 | 1 | $\ldots$ | $\ldots$ | $\mathbf{2}$ | 1 |
| 1 | 1 | 1 | 1 | $\ldots$ | $\ldots$ | $\mathbf{2}$ | 1 |
| 1 | 1 | 1 | 1 | $\ldots$ | $\ldots$ | 1 | $\mathbf{2}$ |
| 1 | 1 | 1 | 1 | $\ldots$ | $\ldots$ | 1 | $\mathbf{2}$ |

## Answer

$2005 \cdot 2006 - 2674 = 4019356$ ones.

## Problem