Hi guys, I've been working optimizing the solution of this problem for a long time; and, I've no idea now why it's getting TLE. The complexity is (NlogN + N * 63). Here it is : https://www.codechef.com/viewsolution/13787521 Algorithm is simple. I'll divide all the elements into 63 stacks as per their log value. Stacks will be processed starting from the one with greatest log value. And, for each element x in the stack, I'll store x/2 into a queue. While processing the next stack (with lower log value), I'll also consider the queue created from the previous step. asked 26 May '17, 10:20
