Problem

Source: 2023 South Russian Girls MO - Assara Juniors p5

Tags: combinatorics, Coloring



In a $5 \times 5$ checkered square, the middle row and middle column are colored gray. You leave the corner cell and move to the cell adjacent to the side with each move. For each transition from a gray cell to a gray one you need to pay a ruble. What is the smallest number of rubles you need to pay to go around all the squares of the board exactly once (it is not necessary to return to the starting square)?