PAML - Popeye and the magical land

no tags 

As usual Popeye and brutus are fighting for olive, and suddenly a witch appears and took popeye to magical land as brutus called that witch. In magical land, the witch with her magic make N(1<=N<=100) number of clones of popeye of different strength(0<=Si<=100) i.e each popeye can hold another popeyes above his head, and number of popeyes which can be hold will be less than or equal to strength of popeye which is holding other popeyes.

Eg: Imagine there are three popeyes: the first has strength 2, the second has strength 1 and the third has strength 1. We cannot put the second and the third popeye simultaneously on the top of the first one. But the second popeye can place directly on the top of the first one, and then the third popeye directly on the top of the second one.We will call such construction of popeye a "Popeye-stack".

The witch want him to make Minimum number of popeye-stack and give her Maximum Height of popeye-stack from that arrangement, then only she release him from the magic and give him spinach to defeat brutus. Help popeye to get released from the magic of the witch.

Input

First line of Input contains no. of test cases T(T<=1000). Each test case contain two lines: 1st line contains N (1<=N<=100) and 2nd line contain N spaced Si (strength of N popoyes) (0<=Si<=100)

Output

For each test case output a string "Case #i: " ("i" is test case number) followed by Minimum number of popeye-stack and Maximum Height of popeye-stack seperated by a space.

Example

Input:
2
5
0 1 2 3 4
9
0 1 0 2 0 1 1 2 10 Output: Case #1: 1 5
Case #2: 3 4

hide comments
Julian Waldby: 2014-10-25 19:05:05

Is one Popeye by himself a Popeye stack of height 1?

heatOn: 2014-06-27 15:33:45

Please check my submission I do not know why I am getting WA I have tried generating many test cases and it is working fine on those. And Please specify does the problem statement ask us to find two seperate arrangements such that in the first minimum number of stacks are used and in the second arrangement maximum height of a stack is obtained ?

@Anuj Yadav - U need to find only one arrangement which is having minimum no. of stacks... and in that arrangement which ever is max. height stack i.e maximum height needed.

Last edit: 2014-05-25 17:00:06
Maru: 2014-06-27 15:33:45

What do you mean by :"Minimum number of popoye-stack"?

Last edit: 2014-05-12 17:49:14
BLANKRK: 2014-06-27 15:33:45

nice one!!!


Added by:P_Quantum
Date:2014-04-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All