MathDB
XOOOXXO -> XXXXO ->O

Source: Canada Repêchage 2024/8 CMOQR

March 25, 2024
combinatorics

Problem Statement

A sequence of XXs and OOs is given, such that no three consecutive characters in the sequence are all the same, and let NN be the number of characters in this sequence. Maia may swap two consecutive characters in the sequence. After each swap, any consecutive block of three or more of the same character will be erased (if there are multiple consecutive blocks of three or more characters after a swap, then they will be erased at the same time), until there are no more consecutive blocks of three or more of the same character. For example, if the original sequence were XXOOXOXOXXOOXOXO and Maia swaps the fifth and sixth character, the end result will be XXOOOXXOXXXXOO.XXOOOXXO \to XXXXO \to O. Find the maximum value NN for which Maia can’t necessarily erase all the characters after a series of swaps. Partial credit will be awarded for correct proofs of lower and upper bounds on NN.