The NTHU campus map is represented by an R × C table A, where Ai, j represents the number of residents (居住人數) in the dormitory located at (i, j). If Ai, j = -1, it means that the dormitory cannot accommodate residents.
We define K as the average dormitory satisfaction, which can be obtained through statistical analysis. Each day, every dormitory will transfer (Integer division, round down) individuals to each of its four adjacent dormitories. Please output the numbers of residents in the dormitories after M days.
Note: Adjacency is defined in the four cardinal directions (up, down, left, and right). If there is no dormitory in that direction or if the adjacent dormitory cannot accommodate residents, no one will be transferred in that direction.
** No Recursion Is Required. :) **
Output a total of R lines, each containing C integers Ai, j, representing the table A after M days.
Remember to print a ‘\n’ at the end of the output.
Do not include any spaces at the end of line.