PAML - Popeye and the magical land
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.
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)
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.
0 1 2 3 4
0 1 0 2 0 1 1 2 10 Output: Case #1: 1 5
Case #2: 3 4
Is one Popeye by himself a Popeye stack of height 1?
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 ?
What do you mean by :"Minimum number of popoye-stack"?Last edit: 2014-05-12 17:49:14