Editorial for CPC '19 Contest 1 P0 - Shoes


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: Plasmatic

If we keep track of the indices of the left and right shoes (respectively), we can simply match the first index of a left shoe with the first index of a right one, the second index of a left shoe with the second index of a right one, etc.

An alternative solution involves simply hard-coding all possible arrangements of shoes, since the number of possible arrangements is very small (there are only 6 of them).

Time Complexity: \mathcal{O}(1)


Comments

There are no comments at the moment.