ENGXOR Logic

CodeChef: Practical coding for everyone (the link of the code)

CodeChef: Practical coding for everyone (this is the problem)

and the code above is the logic I have written
I tried following the logic in the link :

and the 131071 number comes using this code

while submitting in codechef, I am getting a SIGSEGV error, what is the mistake and how do I fix it??

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

1 Like

solution for reference

Your solution is O(nq) which will most definitely TLE. The runtime error is because A_i<10^8 where as you have only precomputed for A_i<131072.
To solve it in O(n+q) refer to

1 Like