April Ltime 2017

I am able to solve this problem with 50 points.

How to remove Runtime error(SIGSEGV) in this problem?

My code:https://www.codechef.com/viewsolution/13411851

the array you are creating is too large!

I believe your array named b and c can be as large as 10^10 which is not allowed (not possible because of memory limit)!

1 Like

For last subtask maximum value of n is 10^5 therefore (n*(n+1))/2 will be of order 10^10.

You are declaring an array c[si] where si = (n*(n+1))/2
Therefore size of array c is of order 10^10

The maximum value of size of an array is 10^7.

Therefore it results in runtime error for last subtask.

How to remove it ? You have to change your algorithm :slight_smile:

1 Like