MathDB
Classic array sorting problem with colouring

Source: SMO Open 2022

July 2, 2022
combinatoricspermutationsminimumcolorings

Problem Statement

Let n,kn,k, 1kn1\le k\le n be fixed integers. Alice has nn cards in a row, where the card has position ii has the label i+ki+k (or i+kni+k-n if i+k>ni+k>n). 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 ii is at position ii).
NOTE: edited from original phrasing, which was ambiguous.