ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1175. Strange Sequence

A person even solved it by using only 53K memory. Can you talk about it?
Posted by helin 29 May 2002 20:47
Re: A person even solved it by using only 53K memory. Can you talk about it?
Posted by Denis Koshman 7 Sep 2008 17:31
If you know that 'n' is on period, you may find 'q' by checking n+1, n+2, n+3, ... till you hit identical to 'n' state. Then, when you know 'q', you may iterate from states '1' and '1+q' till they match, this way you'll find 'p'.

This relies on a guess that iteratively you won't get TL. I used value of 1'500'000, but I don't know if it has a proof or if it means weak tests. For A1>0 there is a proof as there are only ~1M distinct Xi, Xi+1 pairs whose product does not overflow 100'000. But as for A1=0 case - I don't know... Theoretically p or q can be as large as ~100'000^2.
Re: A person even solved it by using only 53K memory. Can you talk about it?
Posted by Fyodor Menshikov 24 Apr 2009 15:10
Is is possible not to set limitation on number of different pairs in solution.

I remembered last pair (x_s, x_{s+1}) where s is the biggest power of two less than current position. And I compared all pairs till the next power of two to this remembered pair.