[CF2289B] 固定子序列位置计数 (Problem from Chebarkul)
Problem Statement
You are given an array of integers and an integer .
Find the number of integers such that in all subsequences of the array of length , the same number is located at the -th position.
Input
The first line contains (). Each test case has (), followed by (). Sum of over all test cases .
Output
For each test case, output one integer — the number of positions with a fixed value across all length- subsequences.
样例
7
1 1
1
3 1
2 2 3
4 2
1 1 1 1
4 2
1 2 1 2
4 4
4 1 4 2
5 3
1 2 2 2 5
6 5
1 1 2 2 1 1
1
0
2
0
4
1
3