|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||93||18||17||22.973%|
Alice and Bob love playing Don’tminion, which typically involves a lot of shuffling of decks of different sizes. Because they play so often, they are not only very quick at shuffling, but also very consistent. Each time Alice shuffles her deck, her cards get permuted in the same way, just like Bob always permutes his cards the same way when he shuffles them. This isn’t good for playing games, but raises an interesting question.
They know that if they take turns shuffling, then at some point the deck will end up ordered in the same way as when they started. Alice shuffles once first, then Bob shuffles once, then Alice shuffles again, et cetera. They start with a sorted deck. What they do not know, however, is how many shuffles it will take before the deck is sorted again.
Can you help them compute how many shuffles it will take? As Alice and Bob can only do 1012 shuffles in the limited time they have, any number strictly larger than this should be returned as huge instead.
3 2 3 1 3 1 2
6 5 1 6 3 2 4 4 6 5 1 3 2
8 1 4 2 6 7 8 5 3 3 6 8 4 7 1 5 2