The permutation approach is too "brute-force", and it may run in something like O((n-1)!), which can't work easily for large inputs.
On 5/8/11, Chi Hang Leung <[email protected]> wrote: > I did use this approach, and this make me fail for the large set. > > On Sun, May 8, 2011 at 2:41 PM, anilsoni85 <[email protected]> wrote: > >> While solving the CandySplitting problem yesterday i was thinking the >> problem can be solve in folllowing steps >> >> 1. Read the candies value and put them in an array of int. >> 2. Create combination of different way sean can split the candies. >> Like for 2nd sample example possible combination could be >> Sean Patrick Sean Sum of his own Candies Patrick's >> XOR of Sean & Patrick candies >> 3 5,6 >> 3 3 3 >> 5 3,6 >> 5 5 5 >> 6 3,5 >> 6 6 6 >> 3,5 6 >> 8 6 6 >> 3,6 5 >> 9 5 5 >> 5,6 3 >> 11 3 3 >> >> Sean maximum Sum of candies where Patrick & Sean candies XOR equal is >> 11 so the solution is 11 >> >> But in solutions i did not found anyone's solution using this >> approch...and now i am having doubt n how the problem can be solved >> without combinations. >> >> -- >> 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. >> >> > > -- > 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. > > -- Sent from my mobile device -- 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.
