In
Mathematics
7. (18th Italian Mathematical Olympiad) In a $4 \times 4$ grid, each small square is filled with a number 1 or 2. If the sum of the 9 numbers in any $3 \times 3$ subgrid (there are 4 such subgrids) is divisible by 4, and the sum of all 16 numbers in the grid is not divisible by 4, find the maximum and minimum values of the sum of these 16 numbers.
7. In a $3 \times 3$ grid, the sum of all numbers can be divisible by 4 in only two scenarios: either 6 ones and 3 twos, with a sum of 12; or 2 ones and 7 twos, with a sum of 16.
Therefore, 1 must appear at least twice, and 2 must appear at least three times.
In the middle $2 \times 2$ grid, fill in any two 1s, and the rest with 2s, the sum of all numbers is 30, which is the maximum value; in the middle $2 \times 2$ grid, fill in any three 2s, and the rest with 1s, the sum of all numbers is 19, which is the minimum value.