#P37A. Towers
Towers
Towers
题面翻译
题面描述
Little Vasya 收到了一个来自青年建筑师的盒子,盒子里有 ()条木头。现在他知道每条木头的长度,如果有两根木头长度一致,则他可以把其中一条放在另一条的顶部。
Vasya 想知道用木头建立的塔的最小数量。帮助 Vasya 以最好的方式使用这些木头(每根木头都要用上)。
输入格式
第一行:。
第二行:每条木头的长度(小于 的自然数)。
输出格式
最大塔的高度(某塔叠放木头数量)及其塔的总数。记住,Vasya 应该利用所有的木头。
题目描述
Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.
输入格式
The first line contains an integer ( ) — the number of bars at Vasya’s disposal. The second line contains space-separated integers — the lengths of the bars. All the lengths are natural numbers not exceeding .
输出格式
In one line output two numbers — the height of the largest tower and their total number. Remember that Vasya should use all the bars.
样例 #1
样例输入 #1
3
1 2 3
样例输出 #1
1 3
样例 #2
样例输入 #2
4
6 5 6 7
样例输出 #2
2 3
相关
在以下作业中: