Runtime error

My code is having run time error in C++ 14. I am globally declaring a large array
matrix [10000][10000]
It works fine on my PC but gives a run time error. How should I declare a large 2-D array then?

No, You can’t make array of size 10^8 i think.
I think you can make array of max size 10^7 globally and can make array of size 10^6 locally.
and i think you were solving 2nd problem of long challenge.
think different way to solve this problem.

2 Likes

@dhruv_gheewala Can you explain that again? I didn’t know it. I think. What are the alternatives to creating array if the size exceeds 10^8? :open_mouth:

Changing the approach to the problem. :slightly_smiling_face:

Can you explain with a short example? A lot of new comers here use compilers with very high array ranges in their PC(s) which isn’t compactable here, so, that’d greatly help the new comers.

Any very short example (not from codechef)

You may go through this article.
With the Sieve of Eratosthenes, you face issues when you have slightly large values of N, where N denotes the size of the range.
This is where, Segmented Sieve comes into play. It has a better locality of reference and doesn’t mind if you give it large values of N to process.
Hope this helps. :slightly_smiling_face:

1 Like

actually i am also stuck at 80 marks on the same problem