not working for all test cases
Deepak and primes
Check Now =>
Run for loop till 7000000 cause 5x10^5 th prime number is 7,368,787 so you have to make sieve according to that.
still segmentation fault
Don’t run on ide.codingblocks.com run it on https://www.codechef.com/ide or local ide of your computer it is running fine on my side.
sir it is one of the challenges so i am running on the coding blocks editor
Check now =>
Passing all test cases.
sir can you explain the changes in prime sieve function
See the link, have commented. one main issue was in line number 9 of your code. you were doing
for(ll i=3;i<=500000;i+=2)
But it should have been
for(ll i=2;i<=1000000;i++)//updated
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.