CF1579F Array Stabilization (AND version)
Description
For example, if $ a = \[0, 0, 1, 1\] $ and $ d = 1 $ , then $ a^{\\rightarrow d} = \[1, 0, 0, 1\] $ and the value of $ a $ after the first step will be $ \[0 \\,\\&\\, 1, 0 \\,\\&\\, 0, 1 \\,\\&\\, 0, 1 \\,\\&\\, 1\] $ , that is $ \[0, 0, 0, 1\] $ .
The process ends when the array stops changing. For a given array $ a$$$, determine whether it will consist of only zeros at the end of the process. If yes, also find the number of steps the process will take before it finishes.
Input Format
Output Format
Explanation/Hint
In the fourth sample test case, the array will not change as it shifts by $ 2 $ to the right, so each element will be calculated as $ 0 \\,\\&\\, 0 $ or $ 1 \\,\\&\\, 1$$$ thus not changing its value. So the answer is -1, the array will never contain only zeros.