Pawns and rooks are placed on a $2019 \times 2019$ chessboard, with at most one piece on each of the $2019^{2}$ squares. A rook can see another rook if they are in the same row or column and all squares between them are empty. What is the maximal number $p$ for which $p$ pawns and $p+2019$ rooks can be placed on the chessboard in such a way that no two rooks can see each other?
Answer: the maximal $p$ equals $1009^{2}$.

Write $n=2019$ and $k=1009$; then $n=2 k+1$. We first show that we can place $k^{2}$ pawns and $n+k^{2}$ rooks. Each cell of the chess board has coordinates $(x, y)$ with $1 \leqslant x, y \leqslant n$. We colour each cell black or white depending on whether $x+y$ is even or odd.

Let $A$ be cell $(1, k+1), B$ be cell $(k+1,1), C$ be cell $(2 k+1, k+1)$ and $D$ be cell $(k+1,2 k+1)$, and consider the skew square $A B C D$. We place rooks on the cells of this square which have the same colour as $A$, and we place pawns on the other cells of this square. In this way, no rook can see another rook. Now we have placed $p=k^{2}$ pawns and $(k+1)^{2}=k^{2}+(2 k+1)=p+n$ rooks.

Now we show that we can not place more pawns. Observe that in every row the number of rooks exceeds the number of pawns by at most 1, since there has to be a pawn between every two neighbouring rooks. So the total number of rooks exceeds the number of pawns by at most $n$. On the other hand we are to place $p$ pawns and $p+n$ rooks, so the number of rooks in every row exceeds the number of pawns by exactly 1. This means that the rooks and pawns alternate, with rooks at the two ends. For the columns the same holds.

Consider the $\ell$-th row. Let $a$ be the number of pawns in this row and let $b$ be the number of pawns above the $\ell$-th row. For all these pawns, a rook must be somewhere above it. Counting the rooks directly above these $a+b$ pawns, we conclude that there must be at least $a+b$ rooks in the first $\ell-1$ rows. In every row the number of rooks exceeds the number of pawns by 1, so in these first $\ell-1$ rows we have at least $a+b-(\ell-1)$ pawns. So $b \geqslant a+b-(\ell-1)$, yielding $a \leqslant \ell-1$. We conclude that the $\ell$-th row contains at most $\ell-1$ pawns. The same holds for the $\ell$-th row counted from below (row $(n+1)-\ell$): also in this row, there are at most $\ell-1$ pawns. As $n=2 k+1$, the maximal number $p$ is

$$
\sum_{\ell=1}^{k}(\ell-1)+\sum_{\ell=1}^{k+1}(\ell-1)=k+2 \cdot \frac{1}{2} k(k-1)=k+k(k-1)=k^{2}
$$