i have tried everything i know to avoid tle but the code gives tle for the last 2 test cases…
i have tried faster I/O…
dynamic memory allocation…
avoiding multiple loops…
but all went in vain…
i just want to learn what is the best way to reduce time complexity…
Please provide more (sufficient) details. Which problem are you talking about? Whose last 2 test cases?
actually i am talking about gcd queries of current JAN long challenge… so i can not post details about my code…until the contest ends… -_-
just want to increase my knowledge…on number of ways…to decrease time complexity…
Ohh I see, faster I/O is not the problem here (as the time limit is 3 sec for C and I have already solved it with score 100).
So try reducing the complexity like reducing the frequency of function calls, try different data-structures, maybe use pre-calculated values or something else.
As this is a LIVE contest, I can not help you more.
P.S. Keep trying, I got my full score after 25 submissions. I was getting 40 points from the beginning like you. So it may seem frustrating at first but it is totally worth it.
i am at 23…submission…and now its getting worse…but i will definitely try until i succeed…
ty for helping