slight modification now it is working

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
repeate step 1 to 4 for number of flavours
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 Mon, Apr 9, 2012 at 10:17 PM, jawa <[email protected]> wrote:

> Hello, iam using the below algorithm to solve the milkshake problem
> http://code.google.com/codejam/contest/32016/dashboard#s=p1
> but iam getting the incorrect answer
> 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:
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-code/-/W36NkGMyFUsJ.
> 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