Re: [gcj] SPOJ - ONEZERO - WA :(

2015-09-11 Thread 7bubble
On Monday, December 17, 2012 at 3:40:11 AM UTC+5:30, Xiongqi ZHANG wrote:
> Hi thefourtheye dIVi,
> 
> Basically your idea is correct and this problem can be solved using BFS.
> 
> However, it is not sufficient to use  to solve this 
> problem because the answer to 19998 is 
> 0 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/
> >
> > 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 google-code@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-code+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >

This code gives segmentation fault for input 110011

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/d5d2e562-6ac3-4846-99af-4248d4a102be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] SPOJ - ONEZERO - WA :(

2015-09-11 Thread Xiongqi ZHANG
110011 isn't a valid input



—
通过 Mailbox 发送

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/1441953127981.1cab30b2%40Nodemailer.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] SPOJ - ONEZERO - WA :(

2012-12-19 Thread ZHANG Xiongqi, Parker
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=3t=3555p=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 
zhangxion...@gmail.com mailto:zhangxion...@gmail.com 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
0 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/

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
google-code@googlegroups.com
mailto:google-code@googlegroups.com.
To unsubscribe from this group, send email to
google-code+unsubscr...@googlegroups.com
mailto:google-code%2bunsubscr...@googlegroups.com.
For more options, visit 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 google-code@googlegroups.com
mailto:google-code@googlegroups.com.
To unsubscribe from this group, send email to
google-code+unsubscr...@googlegroups.com
mailto:google-code%2bunsubscr...@googlegroups.com.
For more options, visit 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 google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.

For more options, visit 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 google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] SPOJ - ONEZERO - WA :(

2012-12-19 Thread thefourtheye dIVi
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 
zhangxion...@gmail.com 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=3t=3555p=**19155http://www.spoj.com/forum/viewtopic.php?f=3t=3555p=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 
 zhangxion...@gmail.com mailto:zhangxion...@gmail.com** 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
 11**110 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
 google-code@googlegroups.com
 mailto:google-code@**googlegroups.comgoogle-code@googlegroups.com
 .

 To unsubscribe from this group, send email to
 
 google-code+unsubscribe@**googlegroups.comgoogle-code%2bunsubscr...@googlegroups.com
 
 mailto:google-code%**2bunsubscr...@googlegroups.comgoogle-code%252bunsubscr...@googlegroups.com
 **.

 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 google-code@googlegroups.com
 mailto:google-code@**googlegroups.com google-code@googlegroups.com
 .

 To unsubscribe from this group, send email to
 
 google-code+unsubscribe@**googlegroups.comgoogle-code%2bunsubscr...@googlegroups.com
 
 mailto:google-code%**2bunsubscr...@googlegroups.comgoogle-code%252bunsubscr...@googlegroups.com
 **.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 google-code@googlegroups.com.
 To unsubscribe from this group, send email to google-code+unsubscribe@**
 googlegroups.com google-code%2bunsubscr...@googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 google-code@googlegroups.com.
 To unsubscribe from this group, send email to google-code+unsubscribe@**
 googlegroups.com google-code%2bunsubscr...@googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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 google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] SPOJ - ONEZERO - WA :(

2012-12-16 Thread ZHANG Xiongqi, Parker

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 
0 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/

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 google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.

For more options, visit 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 google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.