原题:
Color Sequence
1000ms 65536K
描述:
You are given a integer sequence cc of length nn, cici denotes the ithith color in the sequence cc.
We define a color sequence is legal only if it merely contains colors that appear even number of times.
For example, sequence 0,1,0,10,1,0,1 is legal because both color 11 and 00 appear 22 times, and 22 is an even number. And sequence 0,1,00,1,0 is illegal because color 11 only appear 11 time, and 11 is not an even number.
Now, you need to figure out how many consecutive subsequence of cc that is a legal color sequence.
输入:
The first line contains one integer n(1≤n≤106)n(1≤n≤106), the length of the sequence cc.
The second line contains nn integer, the ithith integer denotes the ithith color, ci(0≤ci≤20)ci(0≤ci≤20).
输出:
Print one integer as the answer.
(链接:https://acs.jxnu.edu.cn/problem/ICPCJX2020E)
翻译:
颜色数列
你有一个整数数列c,长度为n,ci代表数列c中第i种颜色。
我们定义一个颜色数列包含的所有颜色仅出现偶数次为合法数列。
例如,数列0,1,0,1是合法的,因为颜色0和1出现次数都为2次,而2为偶数。而0,1,0是非法的,因为颜色1只出现1次,并且1不是偶数。
现在你需要计算多少连续的子序列是一个合法的颜色数列。
输入:
第一行包含一个整数n(1<=n<=10^6),数列c的长度。
第二行包括n个整数,第i个数字表示第i种颜色,ci(0<=ci<=20).
输出:
输出一个整数即答案。