Uh, I pretty much have 0 idea of what to do? How am I supposed to approach this problem? I glanced over the editorial but it wasn’t very helpful on where to start, other than the fact this has some relationship with Permutations…
I don’t even know anymore: I’ve been stuck on this for 3 weeks now.
What do you mean by “glanced over”? The first sentence of the editorial might be a reasonable place to start:
Hint
Call the number of steps that a permutation takes the period of the permutation. Every permutation can be partitioned into cycles of sizes c_1,c_2,c_3,…,c_k such that c_1+c_2+…+c_k=N (see Swapity Swapity Swap from the last contest). Then the period is equal to lcm(c_1,c_2,…,c_k).
Hi! I think to solve this you need to know some stuff about permutations (or how to use OEIS, oops).
The main thing you should know is that the order of a permutation is the LCM of the cycle lengths. Try to figure it out from there, or if you need more help, read the editorial.
Also, this problem is really similar to POI 2004 Maximal (with some other details) so you should try it out after you solve this to make sure you really understand!
the first line of the analysis is scary… how did you even come up with that
Okay, for clarification, I was very stuck on the reasoning behind the order of a permutation is the LCM of cycle lengths. The analysis tells it but it’s up to me to figure that out, which is kind of why I mentally quit.
But good to know that I probably shouldn’t mentally quit… oops.