Let $n$ be a positive integer. An $n\times n$ board consisting of $n^2$ cells, each being a unit square colored either black or white, is called convex if for every black colored cell, both the cell directly to the left of it and the cell directly above it are also colored black. We define the beauty of a board as the number of pairs of its cells $(u,v)$ such that $u$ is black, $v$ is white, and $u$ and $v$ are in the same row or column. Determine the maximum possible beauty of a convex $n\times n$ board. Proposed by Ivan Novak
Problem
Source: 8th European Mathematical Cup, Senior Category, Q2
Tags: combinatorics, Extremal combinatorics
01.01.2020 18:02
Can someone post the solution?
01.01.2020 20:38
Let $a_i$ be the index of the rightmost black cell in row $i$ with $a_i = 0$ if there are no black cells in row $i.$ Then all the cells to its left are black and all the cells to its right are white. We claim that a board achieves$^1$ maximum beauty when $a_i = n-i,$ for which the beauty is $2\sum\limits_{i=1}^n i(n-i) = 2\binom{n+1}{3}.$ When $a_i$ decreases by $1$ and $a_i \ne^* a_{i+1}$ or $i = n,$ the change in contribution from contribution from row $i$ is $(a_i - 1)(n-a_i+1) - a_i(n-a_i) = 2a_i - (n+1).$ However, the contribution from column $a_i$ is $(i-1)(n-i+1) - i(n-i) = 2i-(n+1).$ Since $a_{i-1} \ge a_i > a_{i-1},$ there is no net change in beauty elsewhere, and the total change is $2(a_i+i-(n+1)).$ Thus, we can decrease $a_n, a_{n-1}, \dots, a_1$ in that order (the order is so that $*$ is satisfied) without decreasing beauty until $a_i \le n-i$ for all $i.$ Similarly, if $a_i$ increases by $1$ and $a_i \ne a_{i-1}$ or $i=1,$ the net change in beauty is $(a_i+i)(n-(a_i+1)) - a_i(n-a_i) + i(n-i) - (i-1)(n-i+1) = 2(n-a_i-i),$ so we can increase $a_n, a_{n-1}, \dots, a_1$ in order without decreasing beauty until $a_i \ge n-i$ for all $i.$ This means that from any configuration, we can reach the board where $a_i = n-i$ for all $i$ without decreasing beauty, which means that the maximum occurs$^1$ when $a_i = n-i$ for all $i$ as desired. $^1$ The maximum also occurs when $a_i = n+1-i,$ which is why were careful to say "when" instead of "only when."
11.07.2020 23:28
Call such a pair $(u,v)$ a "pr0" pair . Let $a_i$ denote the number of black cells in the $i$-th row . Note that since the board is convex so $i \leq j \implies a_i \geq a_j$ So ,$$ \# \text { pr0 pairs with both cells in same row } = \sum_{i=1}^{n} a_i(n-a_i)$$. Next note that number of columns with atleast $i$ black cells is atleast $a_i$ . Hence $\#$ columns with exactly $i$ black cells is $(a_i-a_{i+1})$ So $$ \# \text { pr0 pairs with both cells in same column } = \sum_{i=1}^{n} i(n-i)(a_i-a_{i+1}$$. So we want to maximize $$ \mathcal S = \sum_{i=1}^{n} i(n-i)(a_i-a_{i+1}+a_i(n-a_i) = \sum_{i=1}^{n} a_i(2n+1-2i-a_i)$$ Consider the function $f(a_i)= a_i(2n+1-2i-a_i)$ for fixed $i$ . Note that the maximum value of $f$ is attained at $a_i =\{n-i,n+1-i\}$ .It is easy to check $a_i \leq a_{i+1}$ so the board is convex . So the desired sum is := $$\sum_{i=1}^n (n-i)(n-i+1) = \sum_{i=1}^n i^2-i= \boxed{\frac {n^3-n}{6}}$$
15.12.2020 10:30
Interesting Problem. Let $r_i$ be the number of black cells in row $i$. Similarly, let $c_i$ be the number of black cells in column $i$. The convex condition of board is equivalent to: $r_1 \ge r_2 \ge \dots \ge r_n$ and $c_1 \ge c_2 \ge c_3 \dots \ge c_n$. (From the fact that for every black colored cell, both the cell directly to the left of it and the cell directly above it are also colored black.) $c_j = \sum_{r_i \ge j} 1$. (Since the $j$th column counts the number of rows having at least $j$ black cells.) This means that $c_i$, $1 \le i \le n$ is uniquely determined by $r_1, r_2, \dots, r_n$. Now, the beauty of the board having $\{ r_1, r_2, \dots, r_n \}$ number of black squares is \[ \sum_{i = 1}^n r_i (n - r_i) + \sum_{j = 1}^n c_j (n - c_j) \]For the sake of convenience, define $r_0 = c_0 = n$ and $r_{n + 1} = c_{n + 1} = 0$. Claim. The number of $i$ in $\{ c_1, c_2, \dots, c_n \}$, where $0 \le i \le n$ is $r_i - r_{i + 1}$. Proof. Well known. Thus, we need to maximize \[ \sum_{i = 1}^n r_i (n - r_i) + \sum_{j = 1}^n (r_j - r_{j + 1})j(n - j) \]We have \begin{align*} & \ \sum_{i = 0}^n r_i (n - r_i) + \sum_{j = 0}^n (r_j - r_{j + 1} )j(n - j) \\ &= n \sum_{i = 0}^n r_i - \sum_{i = 0}^n r_i^2 + n \sum_{j = 0}^n j(r_j - r_{j + 1}) - \sum_{j = 0}^n j^2 (r_j - r_{j + 1}) \\ &= n \sum_{i = 0}^n r_i - \sum_{i = 0}^n r_i^2 + n \sum_{j = 1}^n (j + 1 - j) r_j - \sum_{j = 0}^{n - 1} ((j + 1)^2 - j^2) r_{j + 1} \\ &= n \sum_{i = 0}^n r_i - \sum_{i = 0}^n r_i^2 + n \sum_{i = 1}^n r_i - \sum_{j = 1}^{n} (2j - 1) r_j \\ &= 2n \sum_{i = 1}^n r_i - \sum_{i = 1}^n r_i^2 - \sum_{i = 1}^n (2i - 1)r_i \\ &=\sum_{i = 1}^n r_i(2n - r_i - 2i + 1) \end{align*}Thus, we want to maximize $\sum_{i = 1}^n r_i (2n - r_i - 2i + 1)$ for all possible $r_1 \ge r_2 \ge \dots \ge r_n$. Define $f(r_i) = r_i (2n - 2i + 1 - r_i)$. Now, we need to maximize $f(r_i)$ for each $i$ by choosing the right value of $r_i$. Now, $f(r_i)$ is maximized when $r_i = \{ n - i, n + 1 - i \}$. Since $n + 1 - i \ge r_i \ge n - i \ge r_{i - 1}$. So, these choices are valid. Thus, the maximum value is attained when $r_i \in \{ n - i, n + 1 - i \}$ for every $1 \le i \le n$, which gives \[ \sum_{i = 1}^n (n - i)(n - i + 1) = \sum_{i = 0}^{n - 1} i(i + 1) = \frac{n^3 - n}{6} \]