Permutation Partitions

CodeForces - 1326C