getting SIGSEGV error.

why i am getting SIGSEGV error for problem LEBOMBS Problem - CodeChef

here is my solution CodeChef: Practical coding for everyone

SIGSEGV error means that you are trying to access invalid memory reference like array element out of bound. In your solution, suppose a test case like this

1

1

0

Here the length of the string is 1. And you are trying to access s[1]. This is the cause of SIGSEGV. Check here.

Hope this clears your doubt.

Happy Coding !!!

1 Like

http://www.codechef.com/viewsolution/6477983

i have corrected fault at all the places i could find, still giving same error. AND why this code is running fine in my code blocks compiler but giving runtime error at ideone???

I think there is a problem in your input function because when I used cin , I got AC. CodeChef: Practical coding for everyone.

PS: I also got AC when I used fast i/o which I generally used. CodeChef: Practical coding for everyone