my code is giving me the correct output but code chef is showing run time error SIGSEGV…please help me how to remove it…here is my code CodeChef: Practical coding for everyone
Your code is giving RTE because u are making an array of 10^9(of n values of input) which is not possible. The max possible array that you can make is less than 10^7.
In this question brute force would not work. try to make an approximately O(1) approach because here g<=20000 and T<=10, so will be ypur approach you need to apply it 2*10^5 times.
When you declare variable ‘N’ as long , you cannot input as scanf("%ld", &N)."%ld" for long int.