Source: USATST-2019-P3
Category: Existence and Construction

Problem:
A \emph{snake of length $k$} is an animal which occupies an ordered $k$-tuple $(s_1, \dots, s_k)$ of cells in an $n \times n$ grid of square unit cells. These cells must be pairwise distinct, and $s_i$ and $s_{i+1}$ must share a side for $i=1,\dots,k-1$. If the snake is currently occupying $(s_1, \dots, s_k)$ and $s$ is an unoccupied cell sharing a side with $s_1$, the snake can \emph{move} to occupy $(s, s_1, \dots, s_{k-1})$ instead. The snake has \emph{turned around} if it occupied $(s_1, s_2, \dots, s_k)$ at the beginning, but after a finite number of moves occupies $(s_k, s_{k-1}, \dots, s_1)$ instead.

Determine whether there exists an integer $n > 1$ such that one can place some snake of length at least $0.9n^2$ in an $n \times n$ grid which can turn around.

Solution:
The answer is yes. We can show that for any $c < 1$, there exists an $n$ such that a snake of length at least $c n^2$ can turn around in an $n \times n$ grid. In particular, this holds for $c = 0.9$.

Let $G$ be any undirected graph. Consider a snake of length $k$ lying within $G$, with each segment of the snake occupying one vertex, consecutive segments occupying adjacent vertices, and no two segments occupying the same vertex. One move of the snake consists of the snake's head advancing to an adjacent empty vertex and segment $i$ advancing to the vertex of segment $i - 1$ for $i = 2, 3, \dots, k$.

The proof proceeds in two stages. First, we construct a planar graph $G$ such that it is possible for a snake that occupies nearly all of $G$ to turn around inside $G$. Then, we construct a subgraph $H$ of the $n \times n$ grid graph such that $H$ is isomorphic to $G$ and $H$ occupies nearly all of the grid.

**Stage 1: Construction of the graph $G$**
Let $r$ and $\ell$ be positive integers. Start with $r$ disjoint *main* paths $p_1, p_2, \dots, p_r$, each of length at least $\ell$, with $p_i$ leading from $A_i$ to $B_i$ for $i = 1, 2, \dots, r$. Add to those $r$ *linking* paths, one leading from $B_i$ to $A_{i + 1}$ for each $i = 1, 2, \dots, r - 1$, and one leading from $B_r$ to $A_1$. Finally, add two families of *transit* paths: the first family contains one transit path joining $A_1$ to each of $A_2, A_3, \dots, A_r$, and the second family contains one path joining $B_r$ to each of $B_1, B_2, \dots, B_{r - 1}$. We require that all paths specified in the construction have no interior vertices in common, with the exception that transit paths in the same family may share vertices.

We claim that a snake of length $(r - 1)\ell$ can turn around inside $G$.

Let the concatenation $A_1 \to B_1 \to A_2 \to B_2 \to \dots \to A_r \to B_r \to A_1$ of all main and linking paths be the *great cycle*. We refer to this direction as the counterclockwise orientation of the great cycle, and the reverse direction as its clockwise orientation.

Place the snake so that its tail is at $A_1$ and its body extends counterclockwise along the great cycle. Then let the snake maneuver as follows. (We track only the snake's head, as its movement uniquely determines the movement of the complete body of the snake.)

- **Phase 1:** Advance counterclockwise along the great cycle to $B_{r - 1}$, take a detour along a transit path to $B_r$, and advance clockwise along the great cycle to $A_r$.
- **Phase $i$ (for $i = 2, 3, \dots, r - 1$):** Take a detour along a transit path to $A_1$, advance counterclockwise along the great cycle to $B_{r - i}$, take a detour along a transit path to $B_r$, and advance clockwise along the great cycle to $A_{r - i + 1}$.
- **Phase $r$:** Simply advance clockwise along the great cycle to $A_1$.

Throughout these phases, because the snake has length $(r - 1)\ell$ and each main path has length at least $\ell$, the required transit paths and segments of the great cycle are guaranteed to be unoccupied when the head enters them. By the end of phase $r$, the snake's tail is at $A_1$ and its body extends clockwise along the great cycle, meaning it has successfully reversed its orientation and turned around.

**Stage 2: Embedding $G$ into the grid**
Let $n$ be a sufficiently large positive integer. Consider an $n \times n$ grid $S$. Number the columns of $S$ from $1$ to $n$ from left to right, and its rows from $1$ to $n$ from bottom to top.

Let $a_1, a_2, \dots, a_{r + 1}$ be cells of $S$ such that all of them lie in column $2$, with $a_1$ in row $2$, $a_{r + 1}$ in row $n - 1$, and the cells approximately equally spaced. Let $b_1, b_2, \dots, b_r$ be cells of $S$ such that all of them lie in column $n - 2$, and $b_i$ lies in the same row as $a_{i + 1}$ for $i = 1, 2, \dots, r$.

Construct the subgraph $H \subset S$ as follows:
- For $i = 1, 2, \dots, r$, let the main path from $a_i$ to $b_i$ be a serpentine path that fills up the rectangle bounded by the rows and columns of $a_i$ and $b_i$ nearly completely. By doing so, every main path has a length of approximately $\frac{1}{r}n^2$.
- For $i = 1, 2, \dots, r - 1$, let the linking path that leads from $b_i$ to $a_{i + 1}$ lie inside the row shared by $b_i$ and $a_{i + 1}$.
- Let the linking path that leads from $b_r$ to $a_1$ lie inside row $n$, column $n$, and row $1$.
- Lastly, let the union of the first family of transit paths be column $1$, and let the union of the second family of transit paths be column $n - 1$, excluding their bottommost and topmost squares.

This grid subgraph $H$ is isomorphic to $G$. As shown in the first stage, a snake of length $k$ approximately equal to $\frac{r - 1}{r}n^2$ can turn around inside $H$, and therefore inside the $n \times n$ grid $S$. 

When $r$ is fixed and $n$ tends to infinity, the ratio $\frac{k}{n^2}$ tends to $\frac{r - 1}{r}$. Furthermore, as $r$ tends to infinity, $\frac{r - 1}{r}$ tends to $1$. By choosing $r \ge 10$ and $n$ sufficiently large, we can achieve a snake of length at least $0.9n^2$ that can turn around, which completes the proof.

Answer: Yes

Grading guidelines:
(Partial) 1. Reformulated the problem on an arbitrary graph, observing that it suffices to build a subgraph of the grid in which a long snake can reverse orientation. 2. Described a concrete “turnaround gadget”/scheme (e.g. a large cycle with detours/transit paths) and explained why the head can use a detour to start moving along the cycle in the opposite direction. 3. Gave a credible embedding idea into an n×n grid (e.g. using long serpentine paths to realize long disjoint paths and using one or two columns as shared transit corridors), with a correct density estimate in the limit (such as achieving length about (r−1)/r·n^2 for fixed r and large n). (Almost) 1. Constructed the graph G with main/linking/transit paths and gave the phase-based maneuver that reverses the snake, but left a small gap in the “unoccupied when needed” verification (e.g. an inequality involving ℓ, r, and how far the tail has moved). 2. Correctly embedded (or outlined embedding of) G into an n×n grid with serpentine main paths and transit columns, and obtained length ≥0.9n^2 for some choice of parameters, but omitted a localized check that the specified paths are internally vertex-disjoint / fit without unintended intersections at corners or endpoints. 3. Solution is almost complete, but made minor mistakes which are not negligible.