I used the same approach and got a wrong answer. I later realized that my
way of dividing the maximum sized pancakes into half was not correct. I
came to this conclusion by looking at the test case 3 6 9 where it is
better to divide 9 into 6 and 3 and then divide both the 6s to 3 sized
pancakes and then allow the diners to eat, resulting in the answer being 6
minutes in all. My initial approach(same as yours gave 7 minutes as the
answer.) What I did to rectify this problem was to divide the maximum sized
pancake into all possible cases(eg. 9 can be divided as (1,8), (2,7),
(3,6), (4,5)) and took the division which gave the minimum time of all.

On Sun, Apr 12, 2015 at 3:45 PM, Xiongqi ZHANG <[email protected]>
wrote:

> 1) If you have 9, 3, 3, 3, 3, .... (many 3s) Then you need two special
> minutes to divide 9 into three 3s, and 3 minutes to eat them all
>
> 2) If you have 9, 5, 5, 5, 5, .... (many 5s) Then you need one special
> minutes to divide 9 into 4 and 5, and 5 minutes to eat them all
>
> So the way you divide numbers depends on all numbers, not just the maximum
> number.
>
> On Sun, Apr 12, 2015 at 6:00 PM Luke Pebody <[email protected]> wrote:
>
>> 1) If you have 6 stacks of size 4, then you are best off just letting
>> everyone eat
>> 2) If you have a stack of size 9, the best thing to do is to have one
>> special minute where you give 3 to some other hungry customer, and then
>> another special minute where you do the same.
>>
>> On Sun, Apr 12, 2015 at 9:10 AM, utkarsh gupta <
>> [email protected]> wrote:
>>
>>> For small B, what I did was to first divide all the maximum sized
>>> pancakes to half giving the extra half to empty plates.Now it will be take
>>> special minutes equal to the frequency of maximum sized sized pancake.Check
>>> if the new maximum sized pancake + the special minutes added is less than
>>> your initial ans, update answer if it less. Now again divide the maximum
>>> into two add the special minutes required and check if the new maximum  +
>>> special minutes is less the your previous ans . Keep doing it until you
>>> have divided each pancake such that every pancake is either <= 3 ,because
>>> for pancake = 1,2,3 answer will be same.
>>> Any help is appreciated.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-code/327a0d00-dc6c-4062-900c-d84da294ee6b%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/CAECKw-ObXjSZBj021L5LkFo3PMBOFso8zLSy7y57VNxLb_%3DWtw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/google-code/CAECKw-ObXjSZBj021L5LkFo3PMBOFso8zLSy7y57VNxLb_%3DWtw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAGDEU-Kxiguv2YurTaZ%2Bpb8VPC_FOZxhAxjsfO7vtVROpRbucw%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-code/CAGDEU-Kxiguv2YurTaZ%2Bpb8VPC_FOZxhAxjsfO7vtVROpRbucw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CABmzNWRxanO_djn0fsx0MAST%2Bp1bfb-JUETcg7BmrHO8t8W7HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to