Tuesday, 11 July 2017

MO's ( Query-Sqrt Decomposition) Algorithm on Tree

I was trying hard to solve a problem from July Long Challenge and even after one day of thinking i was not able to solve it. So i decided to solve sub-tasks. For solving sub-tasks, i decided to use MO's algo (aka Query-Sqrt Decomposition). Prerequisite: MO's algorithm, Euler tour technique...

Thursday, 26 January 2017

AGGRCOW - Aggressive cows SOLUTION

AGGRCOW - Aggressive cows is a good question based on Binary Search! (It took me an hour to figure out, how to crack this nut using binary search :P ) My solution's complexity is O(n logn). If you haven't done a lot of problems based on binary search, then this problem will make you learn something good! Now let us talk about the question. In the problem statement it is given that N...