Https://www.codechef.com/viewsolution/42660569

https://www.codechef.com/viewsolution/42660569

I am getting correct answers using the provided test cases but a “SIGEMT” when I try to run without the test cases. What is going round with my code ?

SIGEMT error generally occurs due to problem in instruction sequence of your code.
For eg - In your code you have taken an array of ‘n’ elements but since you have not given any input for ‘n’ , it leads to a RTE which comes under SIGEMT.

I have taken input of n in line 13

By giving input I meant giving input values for ‘t’ , ‘n’ and ‘array’ , just give custom input of ‘t’ and ‘n’ to just check the effect then this error will not come.