I think that it's harder to do it that way. Do you know how to do those set merge operations efficiently?
On Sep 7, 11:19 pm, Satyajit Malugu <[email protected]> wrote: > So is it like finally we should have all the numbers with prime factor > higher than P (in this case 3) should be in one setand rest constitutes > individual sets? > > From the problem statement - " If the two integers share a prime factor > which is at least *P*, then you merge the two sets to which the two integers > belong." is not confusing to me. > > So the problem boils down to finding all pairs of numbers that don't have a > prime factor that is at least as big as P. Correct? > > > > > > > > On Mon, Sep 7, 2009 at 5:05 PM, <[email protected]> wrote: > > > On Mon, 7 Sep 2009 16:57:11 -0400, Prolific Coder > > <[email protected]> wrote: > > > Now for case 2 - 10 20 3 output is given as 7. Can some one explain how > > is > > > it? I am getting it as 8. > > [cut] > > > 12 - 2*2*3 > > > 15 - 3*5 > > > > Set 1 - 10, 15, 20 > > > Set 2 - 12, 18 > > > Set 3-8 - 11, 13, 14, 16, 17,19 > > > 12 share common prime factor - 3, which is >= P, so you should merge their > > sets (that is, Set 1 and Set 2 from your output). > > That gives you 7 sets. > > > Regards > > Adam > > -- > Satyajit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
