It can be solve using fast matrix exponentiation (modified version, based on XOR operation). Simulate XOR rounds one-by-one using variables, and you'll see that there is pattern of matrix which is move. Start from vector B = [1, 1, 0, ..., 1]. Then do the following process: next[i] = XOR (prev[j] & B[(i + j) % n]) k times. Then multiply (the same operation) result by the array A.
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.