Let be a positive integer. In each square of a array initially there is a zero. In each move it is allowed to choose a row or a column, erase all the numbers in it and then write numbers from to in arbitrary order. What is the maximal possible value of the sum of all numbers in the array?
Solution
Let and let us assume that after some number of moves number appears times in the array (). If we consider the squares in which there is number to be black, and all other squares to be white, then the above statement implies
More generally, if we consider the squares in which numbers () to be black, and all other squares to be white, then the above statement (with ) implies
If we sum all inequalities for we get
On the other hand, we can achieve the equality in the following way. We apply the transformation by alternating between rows and columns, filling the rows from top to bottom and the columns from left to right. We write the numbers in each row in a descending order from left to right and in each column from top to bottom. After these transformations in the first row and the first column there will be number , in the squares of the second row and the second column which are not in the first row/column there will be number , and so on.