I was trying to learn Mo's Algorithm from <a href="http://blog.anudeep2011.com/mos-algorithm/">here</a> and <a href="http://www.spoj.com/problems/DQUERY/">this</a> was one of the suggested problems.↵
But, I'm getting TLE verdict with Java, while my code is very similar to the one that the tutorial's author has written, in C++.↵
↵
Can someone please tell me what am I doing wrong(slow)?↵
Thanks.↵
↵
UPDATE : Sorry, forgot to post a link for my <a href="http://pastebin.com/W0bTnttc">code</a>
But, I'm getting TLE verdict with Java, while my code is very similar to the one that the tutorial's author has written, in C++.↵
↵
Can someone please tell me what am I doing wrong(slow)?↵
Thanks.↵
↵
UPDATE : Sorry, forgot to post a link for my <a href="http://pastebin.com/W0bTnttc">code</a>