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 1468. Fraction

What is the maximum number of divisions needed?
Posted by Lomir 3 Jul 2007 18:02
What is the maximum number of divisions needed to get the full period?
I got TLE this O(n^2) algo there n is the number of divisions.
Re: What is the maximum number of divisions needed?
Posted by Lomir 3 Jul 2007 18:15
O(n*lg n) from number of divisions also TLE.
But why...?
Re: What is the maximum number of divisions needed?
Posted by Lomir 3 Jul 2007 18:26
O(n) AC in 0.234

O(n^2) memorization of prev remainders in vector with linear search
O(n*lg n) memorization of prev remainders in set
O(n) just used bitset<10000> cause all remainders is less then 10000

But why O(n*lg n) TLE!?!?!?