Editorial for MEC '16 P2 - Conveyor Belt


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.

The simplest way to solve this problem is to concatenate the string representing the starting position with itself, and search for the string representing the end position within this new string.

The position of the end string can be used to determine which direction is most optimal to rotate in. Note that if the end position is not found during the search, it is impossible for the conveyor belt to match the end position.

The constraints were lenient, so a basic inefficient search would be enough to pass.

Time complexity: \mathcal{O}(N^2), the time complexity of a standard search.


Comments

There are no comments at the moment.