Mix and Merge

Limits 1s, 512 MB

You are given an array AAA of nnn elements and a constant kkk. You can perform the following operation on the array —


This is a companion discussion topic for the original entry at https://toph.co/p/mix-and-merge