Editorial for Mock CCC '22 1 S2 - IU


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

There is no intended solution for the 1 mark subtask.

For 5 marks, one can greedily simulate the processes, alternating making the first character an I and then a U.

For full marks, we do not need to simulate the process, all the I's are at fixed locations and we can use those locations to establish a lower bound on how many swaps are needed, and that lower bound is directly attainable.


Comments

There are no comments at the moment.