I've tried breaking it up into smaller sized segments, and my array for primes should be about 31622 items long max. Is this too much? Thanks very much.
You're running out of memory. You allocate an array that's M long, which will be <= 1,000,000,001. Assuming the largest possible value, that's 1,000,000,001 bools * 1 bytes per bool which equals 1000Mb. Obviously the problem limit is 32Mb, so it fails.
Comments
Could someone please help with my submission (MLEing last two test cases). https://dmoj.ca/submission/6648597
I've tried breaking it up into smaller sized segments, and my array for primes should be about 31622 items long max. Is this too much? Thanks very much.
tle 😭
no more tle!
I'm getting a segmentation fault on the last test case. Can someone have a look at my code please?
You're running out of memory. You allocate an array that's M long, which will be <= 1,000,000,001. Assuming the largest possible value, that's 1,000,000,001 bools * 1 bytes per bool which equals 1000Mb. Obviously the problem limit is 32Mb, so it fails.