Editorial
Let . For , define , and set for convenience. Since all initial coordinates are distinct, , while for .
Let be the set of coordinates reachable by frog . Then . If , then . If , then is the set of all integers satisfying or . Moreover, every choice of pairwise distinct coordinates can be realized.
Proof of the reachable sets
Translate all coordinates by , placing frog at . The greatest common divisor of the coordinates of the frogs with indices greater than is initially and remains invariant, because replacing by preserves . Every center of a jump by frog is therefore a multiple of , so a jump can only negate its coordinate modulo . This proves necessity.
The reachable sets have a strong nesting property. If , then either or .
Proof of laminarity
For , we have , and is also a multiple of . Suppose the two sets intersect. Reducing the two residues and of modulo gives the two residues and of . Since , every coordinate of belongs to . The finite case and the singleton follow identically.
Process the frogs in the order . Place each frog at a coordinate of its reachable set that is not already used and has minimum absolute value. This greedy algorithm is optimal.
Proof of the greedy algorithm
Take an optimal assignment that already agrees with the greedy choices for all greater indices. For the current frog , let be the greedy coordinate and let be its coordinate in the optimal assignment. The coordinate is not used by any greater index, so .
It remains to find the closest unused coordinate of each . When , let and normalize a residue to . Its coordinates form the nonnegative stream and the negative stream . When , the negative stream starts at .