Editorial for CCC '20 J4 - Cyclic Shifts (Hard)
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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Subtask 1
Most
Full Solution
To solve the problem you will need a fast string matching algorithm with a good constant such as KMP or Z. This is only worth 10% because I don't really like solutions based on constant factors (other than bitset).
Comments