Score : 400 points
You are given a sequence of positive integers of length N, A=a_1,a_2,…,a_{N}, and an integer K. How many contiguous subsequences of A satisfy the following condition?
We consider two contiguous subsequences different if they derive from different positions in A, even if they are the same in content.
Note that the answer may not fit into a 32-bit integer type.
Input is given from Standard Input in the following format:
N K a_1 a_2 ... a_N
Print the number of contiguous subsequences of A that satisfy the condition.
4 10 6 1 2 7
2
The following two contiguous subsequences satisfy the condition:
3 5 3 3 3
3
Note again that we consider two contiguous subsequences different if they derive from different positions, even if they are the same in content.
10 53462 103 35322 232 342 21099 90000 18843 9010 35221 19352
36