Problem

Source: Own. IMO 2022 Malaysian Training Camp 2

Tags: combinatorics



Let $n$, $k$ be fixed integers. On a $n \times n$ board, label each square $0$ or $1$ such that in each $2k \times 2k$ sub-square of the board, the number of $0$'s and $1$'s written are the same. What is the largest possible sum of numbers written on the $n\times n$ board?