my solution was taking only O(nlogn+2qlogn)…its better than (nlogn+qlog^2n)…It was fast read problem in my solution.