We are given a rectangular table with a positive integer written in each of its cells. For each cell of the table, the number in it is equal to the total number of different values in the cells that are in the same row or column (including itself). Find all tables with this property.
Problem
Source: Czech-Polish-Slovak Junior Match 2024, T-6
Tags: combinatorics, combinatorics proposed, Rectangular grid, table, numbers in a table