> With a little tricky maths, it's possible to calculate "the number of > Hamiltonian cycles that use set S of forbidden edges". Using inclusion- > exclusion we can combine these values to get "the number of > Hamiltonian cycles that use any forbidden edges". > > http://en.wikipedia.org/wiki/Inclusion-exclusion_principle > > Glancing at the first few submissions on the scoreboard, this seems to > be the general approach that people took. >
Yes. I had figured out that inclusion-exclusion principle was required to solve. The only thing i had difficulty in what you are referring to little mathematical trick. Turns out that the little trick is always the hardest part to think of while solving a problem. :) Anyway, i have now figured out the approach and have successfully written a working solution. Thanks for your help. regards, Rajat. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
