Getting SIGSEGV error in Secret Recipie problem - May Cook-off 2018

I am getting runtime error for this problem -

Could you please help me solve this issue?




Arrays are 0 based so assign one extra index and you are good to go :slight_smile:

Try this solution :

It is simple to understand.

Still facing the same issue :frowning:


  scanf("%d", &arr[i][j]);


Are you trying to take input of all test cases in this?
Looks like you are new to competitive programming.(Happens with all of us :slight_smile: )
I suggest you take a look at the codes of people who compete.
I have posted a link to an easy to understand solution in the answer above.
Upvote it if you found it helpful :slight_smile:

Video solution here:

change the dimensions of array to store value of all test cases
ex: int T,i,j,arr[100005][6]; //now it’ll hold all values.
edited code:
Hope you won’t get SIGSEGV this time :wink: