Step 4. You have a customer who can be satisfied by flavour 3 malted, and you 
have no evidence that flavour 3 has to be unmalted yet, so you decide to make 
flavour 3 malted. However, this may turn out to be the wrong choice.

For example:
Customer A: Malted 3 or Unmalted 4
Customer B: Unmalted 3 or Unmalted 4
Customer C: Unmalted 3 or Malted 4.

Your solution would, if I understand it correctly, set 3 to Malted for customer 
A, set 4 to Unmalted for customer B and then be left floundering on the rock 
for customer C, and so say "IMPOSSIBLE". There is a solution though - just 
throw the malt away.



On 7 Apr 2012, at 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.

-- 
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