Editorial for Another Contest 8 Problem 3 - Replay Double Ignition
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.
The Fibonacci sequence modulo repeats in elements. Therefore, we can compute the whole string before a repeat and then answer queries by taking indices modulo the length of that string.
Comments
it does repeat eventually, but not always in elements, for example when , it repeats in 60 elements
Big O doesn't care about constants, only asympototical behaviour.