Why TLE O(Q*logn) solution

Link to the problem- SPREAD Problem - CodeChef
Link to my submission - CodeChef: Practical coding for everyone