logo AlgoBeat OnlineJudge
登录 注册

#213039. [NERC 2019] Just Arrange the Icons

内存限制:512 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

BerPhone X is almost ready for release with applications being preinstalled on the phone. A of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given as integers between and , inclusive; the -th application has category .

You can choose --- the number of screens and --- the size of each screen. You need to fit all icons of the applications (one icon representing one application) meeting the following requirements:

  • On each screen, all the icons must belong to applications of the same category (but different screens can contain icons of applications of the same category);
  • Each screen must be either completely filled with icons (the number of icons on the screen is equal to ) or almost filled with icons (the number of icons is equal to ).

Your task is to find the minimal possible number of screens .

输入格式

The first line contains an integer () --- the number of test cases in the input. Then test cases follow.

The first line of each test case contains an integer () --- the number of the icons. The second line contains integers (), where is the category of the -th application.

It is guaranteed that the sum of the values of for all test cases in the input does not exceed .

输出格式

Print integers --- the answers to the given test cases in the order they follow in the input. The answer to a test case is an integer --- the minimum number of screens on which all icons can be placed satisfying the given requirements.

样例

样例输入 1

3
11
1 5 1 5 1 5 1 1 1 1 5
6
1 2 2 2 2 1
5
4 3 3 1 2

样例输出 1

3
3
4

数据范围与提示

In the first test case of the example, all the icons can be placed on three screens of size : a screen with icons of the category , a screen with icons of the category , and a screen with icons of the category .