Problem

Source: Pan-American Girls’ Mathematical Olympiad 2023 P2

Tags: square grid, combinatorics



In each cell of an n×n grid, one of the numbers 0, 1, or 2 must be written. Determine all positive integers n for which there exists a way to fill the n×n grid such that, when calculating the sum of the numbers in each row and each column, the numbers 1,2,,2n are obtained in some order.