Runtime Error!

Question-https://www.spoj.com/problems/TDKPRIME/
My Solution-https://ide.codingblocks.com/s/248338

Sorry, but i won’t be of much help in C++

1 Like

The error is because of array bounds.
The maximum size of vector primes is the total number of primes less than
5000001. But here you are required to find the 5000000th prime which is surely not possible.
Look at my code : https://ideone.com/ktN2u7

1 Like

Re-read the constraints (and the problem)