Type: RemoteJudge 2000ms 256MiB

Towers

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Towers

题面翻译

题面描述

Little Vasya 收到了一个来自青年建筑师的盒子,盒子里有 nn1n10001 \leq n \leq 1000)条木头。现在他知道每条木头的长度,如果有两根木头长度一致,则他可以把其中一条放在另一条的顶部。

Vasya 想知道用木头建立的塔的最小数量。帮助 Vasya 以最好的方式使用这些木头(每根木头都要用上)。

输入格式

第一行:nn

第二行:每条木头的长度(小于 10001000 的自然数)。

输出格式

最大塔的高度(某塔叠放木头数量)及其塔的总数。记住,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 N N ( 1<=N<=1000 1<=N<=1000 ) — the number of bars at Vasya’s disposal. The second line contains N N space-separated integers li l_{i} — the lengths of the bars. All the lengths are natural numbers not exceeding 1000 1000 .

输出格式

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

样例1解释

一共有3个塔, 每个塔的木头数量都是1

样例 #2

样例输入 #2

4
6 5 6 7

样例输出 #2

2 3

样例2解释

一共有5, 6, 7 三个塔, 6塔有两个木头, 所以输出2 3

20230218排序进阶随堂测验

Not Attended
Status
Done
Rule
Ledo
Problem
10
Start at
2023-2-18 10:30
End at
2023-2-18 11:30
Duration
1 hour(s)
Host
Partic.
42