Help me out with this problem--PRIME1 -- >prime generator -->run time error(SIGSEGV)

I am getting TLE , I have used segmented sieve.

here is the problem–>

here is my solution–>
https://www.codechef.com/viewsolution/37057286

You are getting a runtime error(SIGSEGV) not a TLE.

plz explain the diff between the two.
And how to get rid of runtime error

TLE simply means Time Limit Exceeded. This happens because your algorithm took too long to run thus you need to find a way to optimize it.

This link should help you understand (SIGSEGV) https://discuss.codechef.com/t/why-do-i-get-a-sigsegv/1773

2 Likes

Your algorithm could be assessing memory it shouldn’t or it is probably using too much memory. I am finding it a bit difficult to understand some parts of your code though. Check this link out is you haven’t done that already: https://cp-algorithms.com/algebra/sieve-of-eratosthenes.html#toc-tgt-6

1 Like