/ OPS / 题库 /

Max Xor Sub-sequence II

Max Xor Sub-sequence II

#描述#
Give you a sequence of integer numbers which are 1 or 0. You are to find the number of consecutive sub-sequence, which the xor value between all these numbers has the maximum value. The first number of the sequence is 1 and the last is 1. There are (n+1) 1’s in the sequence. N numbers will be given. The i-th number is the index of (i+1)-th 1 minus the index of i-th 1. For example: if the sequence is 1010100010001,
4
2 2 4 4
will be given.

#格式#
##输入格式##
There are multiple cases. For each case:
Line 1: A single integer N (1&lt=N&lt=20000).
Followed N integers ranging from 1 to 20000.

##输出格式##
For each case output the result in a single line.

#样例1#
##样例输入1##

4
2 2 4 4
5
3 1 2 4 5

##样例输出1##

49
70

#限制#
1000ms
32768KB

#提示#
1.1 ^ 1 = 0, 1 ^ 0 = 1, 0 ^ 1 = 1, 0 ^ 0 = 0.
2.In the example, sub-sequence 10 has the maximum value ‘cause 1 xor 0 = 1;the same as 10101, 1010100010001, and so on.

#来源#
DK

信息

ID
1505
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者