Question:-https://www.spoj.com/problems/TDPRIMES/
Code:-https://ide.codingblocks.com/s/382741
Please check where am I going wrong
Question:-https://www.spoj.com/problems/TDPRIMES/
Code:-https://ide.codingblocks.com/s/382741
Please check where am I going wrong
Hey @div_yanshu07
You aren’t printing all the primes
Refer to this discussion TDPRIMES - TLE Even with Optimized Prime Sieves
Okay, I went through the code. My question is we can declare array of 10^7 size rt? as mentioned by other TA, and in this code the guy has taken array of size 10^9 and rest of the process is same as mine for finding the primes. So, how come I am getting tle and this guy isn’t,
My code is this and when I try to increase the array size I get segmentation fault
Hey @div_yanshu07
He is creating 10^8 array
and max size of array will depend on Memory provided in question .
Bool takes 1 byte whereas int takes 4 byte
that’s why u are getting segmentation on increasing size