Editorial for LCC '23 Contest 1 J5 - Chess Cosplay


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: estanzoo

First, when Joshua needs to travel from home to the costume store, the distance is the Hamiltonian Distance between his home and the costume store, which can be found by taking the sum of the absolute difference between the X and Y-coordinates.

Second, on his way back, one can perform a modified BFS (Breadth-First Search) to traverse the graph from the costume store to find the distance between the store and home using exclusively L-shaped paths.


Comments

There are no comments at the moment.