PLEASE HELP

SOLUTION LINK :CodeChef: Practical coding for everyone
PROBLEM LINK: COKE2 Problem - CodeChef
I have implemented the same approach as mentioned in the editorial. I have created a segment tree for storing minimum’s for all segments of 1 to Q. I am not using Lazy Propagation here. I have created three functions : buildTree(), updatetree() and printquery(). Please can anyone tell me why my code is giving WA. It is working fine for sample testcases. Please provide a test case that my code might be failing. PLEASE HELP