runtime error

My solution(c++) is working fine in my computer or Codechef online IDE but it is showing runtime error(SIGSEGV) when i am trying to submit the solution?What are the possible mistakes in the solution?(Problem-CHEFSIGN)

This is an error caused by an invalid memory reference or segmentation fault. The most common causes are accessing an array element out of bounds, or using too much memory.

Some things for you to try:

Make sure you aren’t using variables that haven’t been initialised. These may be set to 0 on your computer, but aren’t guaranteed to be on the judge.

Check every single occurrence of accessing an array element and see if it could possibly be out of bounds.

Also, never declare large arrays inside the main function, declare them globally.

1 Like

Adding to what sudip said, it is possible to frame test cases where some algorithms cause exception. It is possible that its a particular case where your algorithm gets the error.

Like, in algorithm to divide a number by given number n, exception is caused if we input 0.

//