Here is a solution very similar to the one explained by Lev:

http://code.matteolandi.net/svn/hacks/gcj/2009/round-1b/a-decision-tree/script.py

I elaborated it after the contest ending :(


On Sun, Sep 13, 2009 at 9:31 AM, Mahendra Kariya
<[email protected]> wrote:
> @Lev
> Can u elaborate a bit more. Or tell me ur username on codejam. I wud like to
> see ur code.
> Regards,
> Mahendra Kariya
> http://www.mahendrakariya.blogspot.com
>
>
> On Sun, Sep 13, 2009 at 3:50 AM, Lev <[email protected]> wrote:
>>
>> how do you parse the tree?  You can solve this problem without having
>> to build explicit tree data structure.  You can just tokenize the tree
>> string, and then have a simple recursive method that computes
>> probability for each animal.
>>
>> On Sep 12, 2:34 pm, "[email protected]" <[email protected]>
>> wrote:
>> > Missed it by 23 spots =[[[[.
>> > I solved A-small and then began to solve A-large.
>> > I was using eval() in python to parse the tree.
>> > On the large input it gave me a memory error!
>> >
>> > Is there anything I could have done besides parsing the tree manually
>> > or do I deserve this since I was lazy and used eval()?
>>
>>
>
>
> >
>



-- 
M@
http://matteolandi.altervista.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" 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