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

I am getting runtime error for this problem -
https://www.codechef.com/viewsolution/18618608

Could you please help me solve this issue?

Make
arr[3][5];

to

arr[4][6];

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

Try this solution :
https://www.codechef.com/viewsolution/18618293

It is simple to understand.

Still facing the same issue :frowning:

for(i=1;i<=T;i++)
{
for(j=1;j<=5;j++)
{

  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: https://youtu.be/y03Oe5RRVeQ

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:https://ideone.com/8XT6t8
Hope you won’t get SIGSEGV this time :wink: