Help a noob about subtasks

I just wrote my first program on codechef: https://www.codechef.com/viewsolution/23751944

I don’t know how subtasks work and why my code failed, can someone help me?

The code is showing Runtime Error(RE) due to Segmentation Fault(SIGSEGV).
This is because the size your s array can take is 100 max. But in constraints N(or size of your s array) can be as large as 5x10^5 so over flow is there.
Just change the max array size from 100 to 5x10^5 or greater.

5 Likes

Well, Thank You!
I was able to get through the first subtask, will have to maintain time limit to get a perfect score :sweat_smile:

1 Like