Q-matrix
divide-and-conquer, binary search, tricky