Problem:
Each cell of a grid is labeled with a digit in the set . Then, the maximum entry in each row and each column is recorded. Compute the number of labelings for which every digit from to is recorded at least once.
Problem:
Each cell of a grid is labeled with a digit in the set . Then, the maximum entry in each row and each column is recorded. Compute the number of labelings for which every digit from to is recorded at least once.
Solution:
We perform casework by placing the entries from largest to smallest.
- The grid must have exactly one since an entry equal to will be the maximum in its row and in its column. We can place this in ways.
- An entry equal to must be in the same row or column as the ; otherwise, it will be recorded twice, so we only have two records left but , and are all unrecorded. Using similar logic, there is at most one in the grid. So there are ways to place the .
- We further split into cases for the entries. Without loss of generality, say the and the are in the same row.
- If there is a in the same row as the and the , then it remains to label a grid with s and s such that there is exactly one row with all s, of which there are ways to do so.
- Suppose there is no in the same row as the and the . Then there are two remaining empty rows to place a .
There are two possible places we could have a record of , the remaining unoccupied row or the remaining unoccupied column. There are ways to pick one of these; without loss of generality, we pick the row. Then the column must be filled with all s, and the remaining slots in the row with record can be filled in one of ways (, , or ). The final empty cell can be filled with a , or , for a total of ways. Our total here is ways.
Hence, our final answer is .