LA 3510

From Algorithmist
Jump to navigation Jump to search

LA 3510 - Pixel Shuffle[edit]

Summary[edit]

The problem statements defines several operations on square images. Each of the operations is some simple permutation of the image's pixels. The input contains a sequence of operations. Your program should output the smallest positive K such that applying the whole sequence of operations K times always yields the original image.

Explanation[edit]

The sequence of operations defines a (more complicated) permutation of the image's pixels. Split this permutation into cycles, the answer is the least common multiple of the cycle lengths.

Input[edit]

256
rot- div rot div
256
bvsym div mix

Output[edit]

8
63457