Bits concept , How to Crack

Problem link : http://www.codechef.com/CDSU2015/problems/MHTPAIR

Everyone solving this problem with bits concept , I know lots of things about bits but didn’t applied it in any problem.
So How to apply it in this problem Can anybody explain??

Plz anyone help??

???

Most of the people have solved this question using Binary Indexed Tree. You can read more about it from here:
Link

An alternate approach to solving this question would be the divide and conquer strategy ( like the merge sort ) which I had used.
You can check out my solution if you wish to from here Link

2 Likes

Great link, thanks, cleared my doubt. +1

thanks @nellex