Cool. Got ACed... But still, it was almost at the verge of TLE.... :( I see other solutions getting ACed within 0.5 minutes. Wondering what they would be doing...
On Wed, Dec 19, 2012 at 8:33 PM, ZHANG Xiongqi, Parker < [email protected]> wrote: > Bignumber operation can be avoid, but you should not use unsigned long > long anyway. > > http://ideone.com/3nlO2d > > Above is another accepted solution, the idea is still BFS, but without > BigInteger. > > Parker > > > On 2012/12/19 22:14, thefourtheye dIVi wrote: > >> Hi Parker, >> >> Thanks for the Suggestion... I am new to the Big Integer stuff, so >> working on it... Moreover, http://www.spoj.com/forum/** >> viewtopic.php?f=3&t=3555&p=**19155<http://www.spoj.com/forum/viewtopic.php?f=3&t=3555&p=19155> >> >> This thread has a solution similar to what I have implemented but no one >> replied in the thread was worried about the Big Integer, so might it be a >> bug in my implementation which gets me WA? >> >> But 19998 is a very valid input... :( >> >> >> On Mon, Dec 17, 2012 at 3:40 AM, ZHANG Xiongqi, Parker < >> [email protected] <mailto:[email protected]**>> wrote: >> >> Hi thefourtheye dIVi, >> >> Basically your idea is correct and this problem can be solved >> using BFS. >> >> However, it is not sufficient to use <unsigned long long> to solve >> this problem because the answer to 19998 is >> 111111111111111111111111111111**1111110 which is much larger than >> the maximum number that could be represented using unsigned long long. >> >> One more thing to note, you can keep track of all the possible >> remainder and no need to process the remainder that has appeared >> before. The reason for that is left for your exercise. :) >> >> Here is the accepted code which I adapted from yours. >> >> http://ideone.com/7ziUxy >> >> If you have any more questions, fell free to ask. >> >> Parker >> >> >> On 2012/12/16 22:42, thefourtheye dIVi wrote: >> >> I am trying to solve >> http://www.spoj.com/problems/**ONEZERO/<http://www.spoj.com/problems/ONEZERO/> >> >> I referred so many internet posts about this, and they all >> talk about storing reminders and building a tree. I am running >> a simple BFS, nothing else... But this gets me WA :( >> >> http://ideone.com/SZDn5T >> >> Dont know whats wrong with this code. Please help me fix it. >> -- 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] >> <mailto:google-code@**googlegroups.com<[email protected]> >> >. >> >> To unsubscribe from this group, send email to >> >> google-code+unsubscribe@**googlegroups.com<google-code%[email protected]> >> >> <mailto:google-code%**[email protected]<google-code%[email protected]> >> **>. >> >> For more options, visit https://groups.google.com/** >> groups/opt_out <https://groups.google.com/groups/opt_out>. >> >> >> >> -- 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] >> <mailto:google-code@**googlegroups.com <[email protected]> >> >. >> >> To unsubscribe from this group, send email to >> >> google-code+unsubscribe@**googlegroups.com<google-code%[email protected]> >> >> <mailto:google-code%**[email protected]<google-code%[email protected]> >> **>. >> >> For more options, visit >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> . >> >> >> >> -- >> 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 google-code+unsubscribe@** >> googlegroups.com <google-code%[email protected]>. >> For more options, visit >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> . >> >> >> > -- > 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 google-code+unsubscribe@** > googlegroups.com <google-code%[email protected]>. > For more options, visit > https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> > . > > > -- 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 https://groups.google.com/groups/opt_out.
