Start:
All choices for the malt are moved the end if the choice list
ex:3 1,2 0,1 0 given
2 0,2 0,3 1 arranged is the pre condition for this algorithm
For each test case
declare malt and unmalt of size number of flavours,initial values of malt
and unmalt are zeros
1)get all cutomer choices in to choices
2)customer's who have only one choice have to be full filled
if unmalt flavour i is the only choices of the customer then increment the
value of the unmalt[i]+=1
if malt flavour i is the only choices of the customer then increment the
value of the malt[i]+=1
3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
4)Otherwise check the customers who are having more then one choices
for each choices either malted or unmalted at least one should satisfy
below condition
ex:3 1 flavour 3 malted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
malt[i]+=1
if unmalt[3]>0 this choice can not be satified
ex:3 0 flavour 3 unmalted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
if malt[3]>0 this choice can not be satified
5)at least one of the each customer choice are satisfied according to the
step 4
then print all malt[i] if malt[i]>0 print 1 else 0
End:

On Sat, Apr 7, 2012 at 6:31 PM, Samuel Jawahar <[email protected]> wrote:

> Thanks a lot for giving response
> But i need u to go through my algorithm
> did you check my algorithm?can you please
> Regards
> Samuel
>
>
> On Sat, Apr 7, 2012 at 6:18 PM, Abizern <[email protected]> wrote:
>
>> Have a look at this explanation with a solution:
>>
>> http://www.necessaryandsufficient.net/2008/07/google-code-jam-milkshakes/
>>
>>
>> On 7 April 2012 12:55, Samuel Jawahar <[email protected]> wrote:
>>
>>> Hello if you have time can you please verify my algorithm to solve the
>>> milkshake problem
>>>
>>> start:
>>>
>>> For each test case
>>> declare malt and unmalt of size number of flavours,initial values of
>>> malt and unmalt are zeros
>>> 1)get all cutomer choices in to choices
>>> 2)customer's who have only one choice have to be full filled
>>> if unmalt flavour i is the only choices of the customer then increment
>>> the value of the unmalt[i]+=1
>>> if malt flavour i is the only choices of the customer then increment the
>>> value of the malt[i]+=1
>>> 3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
>>> 4)Otherwise check the customers who are having more then one choices
>>> for each choices either malted or unmalted at least one should satisfy
>>> below condition
>>> ex:3 1 flavour 3 malted
>>> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
>>> malt[3]+=1
>>> if unmalt[3]>0 this choice can not be satified
>>> ex:3 0 flavour 3 unmalted
>>> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
>>> unmalt[i]+=1
>>> if malt[3]>0 this choice can not be satified
>>> 5)at least one of the each customer choice are satisfied according to
>>> the step 4
>>> then print all malt[i] if malt[i]>0 print 1 else 0
>>>
>>> end:
>>>
>>> On Sat, Apr 7, 2012 at 3:52 PM, Abizern <[email protected]> wrote:
>>>
>>>> Not yet, but I'll consider doing a 'cast about it next.
>>>>
>>>>
>>>> On 7 April 2012 10:57, Samuel Jawahar <[email protected]> wrote:
>>>>
>>>>> Hello.did you solve the problem milkshake
>>>>> http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1
>>>>>
>>>>>
>>>>> On Sat, Apr 7, 2012 at 2:58 PM, Abizern <[email protected]> wrote:
>>>>>
>>>>>> I made a short screencast last night to show the process of solving a
>>>>>> problem, retrieving the input files and uploading the solutions for the
>>>>>> small and large cases.
>>>>>>
>>>>>> http://youtu.be/_tgv3HVgOMc?hd=1
>>>>>>
>>>>>> If you aren't interested in the (trivial) solution in Haskell, skip
>>>>>> to the last few minutes to see the mechanics of submitting the final
>>>>>> solution files.
>>>>>>
>>>>>> --
>>>>>> Abizer
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Google Code Jam" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected].
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/google-code?hl=en.
>>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google Code Jam" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/google-code?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Abizer
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-code?hl=en.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>>
>>
>> --
>> Abizer
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to