CCC past papers hide a large problem family: a grid (a field, a maze, a letter table, a triangle strip) and something to do on it. They look scattered — count a perimeter, flood a field, hunt a word — but classified by “how does information move on the grid” there are exactly three generations: cell-by-cell simulation, structural counting, and graph search. Once you see the three, you own the family map: meet a new problem, ask “which generation is it”, and pick the weapon accordingly. This article lines up the five published grid walkthroughs into one evolution and explains each generation’s core structure and exemplar problems.
Generation One: Cell-by-Cell Simulation — “Where Am I, What Is My State”
The simplest generation: one agent moves on the grid by rules, and you maintain its position and the state along the way. The core structure is two variables plus one set: (row, col) for the current cell and a visited set recording where it has been, so it never walks in circles.
The exemplar is the CCC 2026 J4 Snail Path walkthrough: a snail crawls by instructions and may not revisit any cell. The solution simulates each step: parse the direction, compute the new coordinates, check visited, update the position. The traps in this generation are not algorithmic but at the boundaries: a typo in the direction array, one missing bounds check, the order in which visited is marked versus when a cell is dequeued — all prime targets for a state-table dry run before you submit.
Generation Two: Structural Counting — “Ignore the Walk, Read the Shape”
Generation two stops tracking an agent and treats the grid as a static structure, asking about global quantities: how long is the perimeter, how many connected components, how many times a pattern appears. The core technique is direction vectors plus neighbor iteration: for each cell, inspect its four (or diagonal) neighbors and accumulate whatever the statement asks for.
CCC 2023 J4/S1 Trianglane is the exemplar: a row of triangles where the shared edge of each adjacent pair must be subtracted from the perimeter — nothing to “walk”, just one subtraction per neighbor pair. CCC 2021 J5/S2 Modern Art counts row and column flips: maintain flip state per row and per column, then settle the score at the end. The keyword of this generation is “local contribution”: each cell’s contribution to the answer depends only on its neighbors, so get every local term right and the global answer takes care of itself.
Generation Three: Graph Search — “Cells Are Nodes, Adjacency Is Edges”
Generation three views the grid explicitly as a graph: each cell is a node, adjacency is an edge, and the question becomes “which nodes are reachable from the start” or “what is the shortest path”. Two traversals — DFS (recursion or stack) and BFS (queue) — cover nearly everything in this generation.
Two classic contrasts: CCC 2024 J5 Harvest Waterloo asks for the number and size of connected regions — DFS or BFS, your choice, with the visited set mandatory; CCC 2020 J5/S2 Escape Room makes the door-handle rule depend on factoring each cell’s value, which is an implicit graph — the adjacency is not given directly but computed on demand from the statement. And the full direction-vector family appears in CCC 2023 J5 Word Hunt: start at every cell and extend the word match along all eight directions.
The Three Generations, Side by Side
| Generation | Core structure | Exemplars | How to recognize |
|---|---|---|---|
| Simulation | position + visited set | Snail Path | “an agent walks step by step” |
| Counting | direction vectors + neighbor scan | Trianglane / Modern Art | “a global quantity, no process” |
| Graph search | grid as graph, DFS/BFS | Harvest Waterloo / Escape Room / Word Hunt | “reachability, components, or paths” |
The First Trap of Each Generation
- Simulation: marking visited too late — a cell should be marked at the moment it is enqueued (or the step is taken); waiting until you arrive lets the same cell be enqueued twice.
- Counting: flipping one row of the direction array (writing
(0,-1)where(-1,0)was meant) breaks every local contribution, and the samples often fail to reveal it. - Search: enqueueing without a duplicate check in BFS floods the queue with repeated nodes, and slightly larger data blows the memory limit or the time limit.
How to Use the Map
For a new grid problem, locate it with three questions. First: is there an agent moving by rules? If yes, it is probably simulation — write the coordinate update and the visited set first. Second: is the question about a global quantity that ignores the process? If yes, find the direction vectors and accumulate local contributions. Third: does it ask “can we reach it, how many are there, how far is it”? Then it is graph search — translate the grid into adjacency, and choose DFS (connectivity only) or BFS (shortest steps). After locating the generation, dry-run the idea on a small sample before writing the full program — grid samples are all small enough to draw on paper, which is the gift these problems give to anyone training on them.
Real problems often hybridize, of course: Escape Room is “simulation plus graph search”; Modern Art is “counting plus parity analysis”. But hybrids are still assembled from these three blocks — classify the skeleton into its generation first, then handle the mixed-blood part. After finishing this article, spend ten minutes re-reading each of the five anchor walkthroughs against the table: look only at each one’s “core structure” section, and verify that you can name its generation at a glance — that recognition speed is exactly the algorithm-choosing speed you will need in the contest room.
One Line to Remember
Three generations of grid problems: simulation tracks state, counting reads neighbors, search tests connectivity — ask “how does information flow on the grid” and the answer’s structure appears.
Questions or feedback?
Have a question about this article or want to suggest an improvement? Send us an email.
