Whats wrong in my code of COPS?

I have written a code but when I submit it, it gives me error SIGSEGV.
My code is here:- https://www.codechef.com/viewsolution/18896596

Here is a link for AC solution: https://www.codechef.com/viewsolution/18896659

SIGSEGV error is because you were accessing index out of bounds. You created an array of size M and accessing index M, but the valid index was 0 to M-1. hou array was also not big enough, hence I increased its size.

1 Like