Hello coders,

i was reading a blog on MO algorithms written by anudeep Blog.

its really good, you can try too.

but i got stuck on one of practise problem of this blog Powerfull array .

constraints should allow mo algorithm to run but still getting TLE.

Here is my Solution.

can someone please help me out , what’s problem in this code ?

TL is tight but it is still solvable using MO. My Soln. Just change your sorting order. It is more optimised version of MO.

using minimum no of long long variables worked for me!

i made two important changes in my solution and it got accepted.

first one was of making constant block size equal to 1000.

and other one using minimum number of long long int