Editorial for CCC '21 J4 - Arranging Books

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.

This problem is almost identical to CCC '20 S4 - Swapping Seats except instead of a circular array, you simply have an array. The solution from subtask 3 of that editorial can be applied verbatim.


There are no comments at the moment.