# number of ways to fill a 2D grid

We have a 2D grid with n rows and m columns, we can fill it with numbers between 1 and k (both inclusive). Only condition is that for each r such that 1<=r<=k ,no two rows must have exactly the same number of the number r. We have to find the number of ways in which we can fill the grid .

-

Well, if no two rows can have the same number, you would be able to have a maximum of $k$ columns, since once you use the numbers from $1$ to $k$ in a row, you can't go any farther.
I think besides that there are no restrictions, so for a maximum size board you would have $nk!$ ways to do it.