#P9236. [蓝桥杯 2023 省 A] 异或和之和
[蓝桥杯 2023 省 A] 异或和之和
Problem Description
Given an array , compute the XOR sum of every subarray and then sum up all these XOR sums. In other words, for every pair satisfying , compute the XOR of the elements from the -th to the -th in the array, and output the total sum of the results over all such .
Input Format
The first line contains an integer .
The second line contains integers , separated by a single space.
Output Format
Output one line containing an integer representing the answer.
5
1 2 3 4 5
39
Hint
Constraints
For of the testdata, .
For of the testdata, .
For all testdata, , .
Translated by ChatGPT 5