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:- CodeChef: Practical coding for everyone

Here is a link for AC solution: CodeChef: Practical coding for everyone

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