Who wouldn't love to have powers? Especially ones that are unique and exclusive?
Your task today is related.
Given an array of numbers, count the number of ranges that have an XOR-sum which is a positive power of . (XOR = eXclusive-OR).
Input Specification
The first line contains two integers, and , the number of integers and the base.
The second line contains space-separated integers, representing the numbers of the array.
Output Specification
The output should contain one line containing one integer, the number of ranges with a xor-sum that is a positive power of .
Constraints
For all subtasks:
Subtask 1 [19%]
Subtask 2 [29%]
Subtask 3 [52%]
Subtask 4 [0%]
Sample test cases.
Sample Input
4 2
1 7 2 9
Sample Output
2
Explanation
The ranges are and .
Comments
How come kobortor has a score of 100/100, yet he is listed as having a wrong answer?
:)