Problem

Source: 2020 Cyberspace Mathematical Competition P7

Tags: combinatorics, cyberspace



Each of the $n^2$ cells of an $n \times n$ grid is colored either black or white. Let $a_i$ denote the number of white cells in the $i$-th row, and let $b_i$ denote the number of black cells in the $i$-th column. Determine the maximum value of $\sum_{i=1}^n a_ib_i$ over all coloring schemes of the grid. Proposed by Alex Zhai