I m getting WA and TLE for my code in this September long challenge please find the test case and tells about its time complexity

question :long challenge sept icin

my code:https://www.codechef.com/viewsolution/26585210

thanks in advance

what my approach is that

its given 1<a<A,1<b<B,1<c<C and b*b<a*c

if either A or C is less than B than we just follow the normal procedure two fix two element and find the third element

so the only case left if both A and C is grater than B then what I m can doing is I made the nested loop for a( up to B) and b elements and made them pair with c after that the range left is A-B this is not paired yet after that I made the nested loop for c and b and the range of c(up to B) and B and find values of a in the range A-B as it not pair yet .

and at last the range of A-B and C-B can make pair with any team in b so that can be easily multiplied and we can find the result by adding them

please help me. out where is my approach is wrong…

You’re simply messing up the mod operations somewhere! I faced this same situation,and for TLE, you just need to optimize your code a lot !

but time complexity I think is O(2*b*b) which is under limit

Yeah i know…but that’s the thing i had to optimize a lot or it won’t pass

optimise in what manner can you elaborate