#X. XHXMMMl31UFTWg#^_@;
XHXMMMl31UFTWg#^_@;
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Statement
You have a hand of cards, where each card has a number written on it, and a fixed integer . You can perform the following operation any number of times:
- Choose any cards from your hand that all have the same number.
- Exchange these cards for cards, each of which can have any number you choose (including the number written on the cards you just exchanged).
Here is one possible sequence of operations for the first example case, which has :
What is the minimum number of cards you can have in your hand at the end of this process?
Format
Input
The first line of the input contains a single integer ( ) — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers and ( , ) — the number of cards you have, and the number of cards you exchange during each operation, respectively.
The next line of each test case contains integers ( ) — the numbers written on your cards.
Output
For each test case, output a single integer — the minimum number of cards you can have left in your hand after any number of operations.
Sample
7
5 3
4 1 1 4 4
1 10
7
7 2
4 2 1 100 5 2 3
10 4
1 1 1 1 1 1 1 1 1 1
5 2
3 8 1 48 7
6 2
10 20 30 10 20 40
6 3
10 20 30 10 20 40
2
1
1
3
5
1
6
ShanghaiTech ACM 炸鱼杯
- 状态
- 已结束
- 规则
- OI
- 题目
- 46
- 开始于
- 2024-12-10 23:00
- 结束于
- 2024-12-15 13:00
- 持续时间
- 110 小时
- 主持人
- 参赛人数
- 112