Editorial for COCI '19 Contest 5 #2 Političari
Submitting an official solution before solving the problem yourself is a bannable offence.
It was possible to score
To score all points on this task, it was necessary to observe that the blaming process is cyclical. Since the next guest on a talk show solely depends on the previous guest and the person who blamed the previous guest, we can conclude that there are at most
Since the total number of different shows is considerably less than the maximum episode in which we are interested in, we can simulate the process until we reach the show we have seen before (already visited state). At that moment, assuming that we keep track of some key items that have happened, we can use the power of math to calculate who will be the guest of the
Let's assume we have realized that the
Time complexity of the described solution is
Comments