|
|
back to boardYes,I know all this.My algorithm is O(sqrt(n)),but I got Time Limited exceeded.The program uses only 1.5 sec at my computer when K=1000 and the dataset is random.It will cost also O(sqrt(n)) to get p Use precalc. array of all primes <= sqrt(10^9), I think ur program'll be much faster > You think I'm so fool.Of course,I know such trick.Maybe the timelimit is too strict.I'll try more > > This problem has a solution fastre than O(sqrt(N)) It has a pure analitical solution with almost no cycles needed :-) The test are specially made so to do not allow all the possible O(sqrt (N)) solutions pass! |
|
|