Classic array sorting problem with colouring
Source: SMO Open 2022
July 2, 2022
combinatoricspermutationsminimumcolorings
Problem Statement
Let , be fixed integers. Alice has cards in a row, where the card has position has the label (or if ). Alice starts by colouring each card either red or blue. Afterwards, she is allowed to make several moves, where each move consists of choosing two cards of different colours and swapping them. Find the minimum number of moves she has to make (given that she chooses the colouring optimally) to put the cards in order (i.e. card is at position ).NOTE: edited from original phrasing, which was ambiguous.