https://ide.codingblocks.com/s/70545
can you please help me with this code. I have used all possible optimizations but still in 2 test cases this code gives me eithe TLE or runtime error.
https://ide.codingblocks.com/s/70545
can you please help me with this code. I have used all possible optimizations but still in 2 test cases this code gives me eithe TLE or runtime error.
you are not using segmented sieve properly.
in Segmented Sieve From line 39 to 47 in your code
For every Prime in primes.size()
mark all numbers between m to n as not prime .
you are using j++ which is O(n) complexity .
Think something like j=j+i kind of approach O(logn).
9873225242 WhatsApp pm