Haha, exactly my point.
Image of code is worse. What do we do to that image? We can atleast copy paste code to debug it.
After simplifying above calculation the formula which we get is
(( 3 * X)+(a+b+c) ) * ((2 * X)+(j+k))
How did you arrive at this result? I will appreciate hints on the thought process since i tried hard but couldnt simplify the function.
Enjoy the karma and thanks !
Step 1: (a+X)(X+j)+(a+X)(X+k)+
(b+X)(X+j)+(b+X)(X+k)+
(c+X)(X+j)+(c+X)(X+k)
Step 2: (a+X)(X+j+X+k)+
(b+X)(X+j+X+k)+
(c+X)(X+j+X+k)
Step 3: (a+X+b+X+c+X)(X+j+X+k)
Step 4: (3X+a+b+c)(2X+j+k)
Damn, it was quite simple. I just opened the bracket and lmao…XD Utter Disaster XD
looks good
Don’t use quicksort, its worst case tuns till On2, try some inline sort or merge sort.
Adding “std::ios::sync_with_stdio(false);” fixed the issue. Check out performance - Using scanf() in C++ programs is faster than using cin? - Stack Overflow for further details. Upvotes are still appreciated.
@godslayer12 with quicksort algo it was working later suddenly it pops out tle when i just put some more mod . adding mod to the algo in no way can change the running time as it is a constant operation and that too not in the sorting step also even if i use mergesort it is giving wa . please tell what is the issue in the code
That’s some example of self help! good going
Can’t identify the flaw clearly, ask a question here: "I want to ask a question" - Ask them all here! - meta - CodeChef Discuss
People will surely help
You are making presum array in each query(B[i]). Just do it once before you start answering queries for each B[i]. Please look at my code and sorry for the late reply
Use scanf and printf instead of cin and cout
Yeah actually that was it
Hey thanks, this helped a lot
avoid duplicate threads for same question… delete one of them…