Problem

Source: 2022 China TST, Test 2, P1

Tags: graph theory, grid, combinatorics



Find all pairs of positive integers $(m, n)$, such that in a $m \times n$ table (with $m+1$ horizontal lines and $n+1$ vertical lines), a diagonal can be drawn in some unit squares (some unit squares may have no diagonals drawn, but two diagonals cannot be both drawn in a unit square), so that the obtained graph has an Eulerian cycle.