Score


  • محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

A kk-partition of an array means dividing the array into groups of kk elements. The first kk elements go in the first group, the next kk elements in the second group, and so on... If there are fewer than kk elements left at the end, place all remaining elements in the final group.

For example, if the initial array is [3,0,2,1,2][3, 0, 2, 1, 2] and k=2k=2, the grouping would be [[3,0],[2,1],[2]][[3, 0], [2, 1], [2]]

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 33, the score of the group [2,1] is 33, and the score of the group [2] is 22. 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 kk as 1,2,3,...,n1, 2, 3, ..., n, 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. 1n1061 \leq n \leq 10^6 The second line contains n integers a1,a2,,ana_1, a_2, \dots, a_n\, separated by spaces.

0ai1090 \leq a_i \leq 10^9

output🔗

Print a single line containing the total scores of the array for k=1,2,,nk = 1, 2, \dots, n separated by spaces.

example🔗

sample input 1🔗

4
1 2 3 4
Plain text

sample output 1🔗

0 3 0 4
Plain text

sample input 2🔗

5
3 0 2 1 2
Plain text

sample output 2🔗

0 2 1 0 2
Plain text
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.