Problem

Source: Russian Regional Olympiad 2010 11.8

Tags: combinatorics



The numbers $1, 2,. . . , 10000, $ were placed in the cells of a $100 \times 100$ square, each once; in this case, numbers differing by $1$ are written in cells adjacent to each side. After that we calculated distances between the centers of every two cells whose numbers differ by exactly $5000$. Let $S$ be the minimum of these distances What is the largest value $S$ can take?