How to solve using sqrt Decomposition?

Problem link:https://www.spoj.com/problems/DQUERY/

This problem can be solved with Mo’s algorithm. But can anyone please tell me how to solve this problem using square root decomposition??