DR.WANG Mathematics中文

2013 USAJMO · Question 2

Counting & combinatorics · grid

Problem outline

Fill an m×nm\times n rectangular grid with nonnegative integers, where m,n≥1m,n\ge1. Values in cells sharing a side must differ by at most 11. Every cell with no strictly smaller side-neighbour must contain zero. How many fillings satisfy both rules?

Show answer and methods 1 methods

Answer

2mn−12^{mn}-1.

Method 1 Recover the filling from its zero cells

In any legal filling a cell of minimum value must be zero. Let SS be the nonempty set of all zero cells, and consider a cell marked dd. A path from it to SS needs at least dd steps, since each step can lower the value by at most one.

Whenever the current value is positive it has a smaller neighbour by the second rule. That neighbour has value exactly one less by the first rule. Continue for dd steps to reach zero. Thus the value in every cell equals its shortest side-step distance to SS.

Conversely, choose any nonempty set SS and fill with these shortest distances. Neighbouring distances differ by at most one, by extending a shortest path by a single edge. A positive-distance cell has a smaller neighbour on such a path. The zeros are exactly SS, so different choices give different fillings. Of the 2mn2^{mn} subsets only the empty one is excluded.

Source and attribution

The outline and worked methods on this page were prepared for DR.WANG Mathematics.

Original question (external)