Unordered Swaps solution codeforces
Unordered Swaps solution codeforces Alice had a permutation pp of numbers from 11 to nn. Alice can swap a pair (x,y)(x,y) which means swapping elements at positions xx and yy in pp (i.e. swap pxpx and pypy). Alice recently learned her first sorting algorithm, so she decided to sort her permutation in the minimum number of swaps possible. She wrote down all the swaps in the order in which she performed them …