CF1642B Power Walking

题目描述

将 $n$ 个数 $a_1$ 至 $a_n$ 分成 $k$ 组,求每组中去重后的元素个数之和的最小值。

输入格式

本题采用多组数据。 第一行,一个整数 $t$ ,表示数据组数。 对于每组数据: 第一行,一个整数 $n$ ,表示元素个数。 第二行,$n$ 个整数,表示待分组的元素 $a_1$ 至 $a_n$ 。

输出格式

对于每组测试数据,输出 $1$ 行 $n$ 个以空格分割的整数,表示 $k$ 从 $1$ 到 $n$ 的运算结果。

说明/提示

One of the ways to give power-ups to minimise the sum of strengths in the first test case: - $ k = 1: \{1, 1, 2\} $ - $ k = 2: \{1, 1\}, \{2\} $ - $ k = 3: \{1\}, \{1\}, \{2\} $ One of the ways to give power-ups to minimise the sum of strengths in the second test case: - $ k = 1: \{1, 2, 2, 2, 4, 5\} $ - $ k = 2: \{2, 2, 2, 4, 5\}, \{1\} $ - $ k = 3: \{2, 2, 2, 5\}, \{1\}, \{4\} $ - $ k = 4: \{2, 2, 2\}, \{1\}, \{4\}, \{5\} $ - $ k = 5: \{2, 2\}, \{1\}, \{2\}, \{4\}, \{5\} $ - $ k = 6: \{1\}, \{2\}, \{2\}, \{2\}, \{4\}, \{5\} $