TLE ERROR ON 5 TEST CASES OUT OF 6


I had build segment tree with 0 indexing on initial array “a” … and finally computed f( gcd(a,b,c…) )…
but it’s still showing tle… I’m not able to figure out what’s wrong in code…

Hey @perul1999
Code seems fine logically
Must be some small error
PLease cross verify with this

even your code is showing TLE on the same cases as of mine… so now check it again…

@perul1999
There must be an issue with the judge
The code was added after testing
I’ll inform the team of the issue

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

stil same tle error…

Hey @perul1999
I have sent the request to the team
Please wait for a week
In the mean time as and when the issue will be resolved I’ll msg you on this thread

@perul1999,
Try writing an iterative power function, maybe recursive one is too slow for this problem.

https://ide.codingblocks.com/s/263252 it’s still showing tle even after changing power function to non recursive… I’m not able to figure out what’s wrong in code…

@perul1999,
There problem seems to have unnecessarily tight time limit, you can skip the problem.

@perul1999 hey, this question utilizes a mathematical property:
GCD(Fib(A),Fib(B))=Fib(GCD(A,B))
So we need to form a seg tree on the array (not on Fibonacci number)
After number calculation we will need to use matrix exponentiation to get Fib number.
Use matrix exponentiation for that,check this code:

rishabh i implmented all the same as u r saying…

@perul1999 hey mene changes kie hai ,upar wala code dekho ek bar pls.