You are given a integer sequence cof length n, cidenotes theithcolor in the sequence c. 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,1}is legal because both color 1and 0appear 2times, and 2is an even number. And sequence {0,1,0}is illegal because color 1only appear 1time, and 1is not an even number. Now, you need to figure out how many consecutive subsequence ofcthat is a legal color sequence.
You are given a integer sequence c of length n, ci denotes the ith color in the sequence c. 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,1} is legal because both color 1 and 0 appear 2 times, and 2 is an even number. And sequence {0,1,0} is illegal because color 1 only appear 1 time, and 1 is not an even number. Now, you need to figure out how many consecutive subsequence of c that is a legal color sequence.
(图片来源网络,侵删)