time limit error

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…

3 Likes

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… -_-

3 Likes

just want to increase my knowledge…on number of ways…to decrease time complexity…

2 Likes

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.

1 Like

i am at 23…submission…and now its getting worse…but i will definitely try until i succeed…
ty for helping

3 Likes