- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
A -partition of an array means dividing the array into groups of elements. The first elements go in the first group, the next elements in the second group, and so on... If there are fewer than elements left at the end, place all remaining elements in the final group.
For example, if the initial array is and , the grouping would be
The score of a group is defined as the bitwise XOR sum of its elements. For example, the score of the group [3,0]
is , the score of the group [2,1]
is , and the score of the group [2]
is .
The score of the entire array is the bitwise AND of the scores of all its groups. For the grouping above, the total score of the array is:
3 AND 3 AND 2 = 2.
for each as , calculate the score for a fixed array.
input
The first line of input contains a positive integer n, the number of elements in the array. The second line contains n integers separated by spaces.
output
Print a single line containing the total scores of the array for separated by spaces.
example
sample input 1
sample output 1
sample input 2
sample output 2
ارسال پاسخ برای این سؤال