Link to the Code : http://ideone.com/GDJB5QMy Approach was offline.First I sorted the elements of the Input array and the Queries based on their k value.Then I traversed the Sorted Array(Descending) if it was an Input Array element update the SegementTree[Original Position] value to 1.else I Query the Segment Tree and store Result in Output array at it's Original Position(Query's Position).I am not able Figure Out why it's giving runtime error .
My code is exactly same like u, did u get the reaaon for this problem,pls give response on anubhavaron000051@gmail.com,if u get the reason
Maybe becouse you use long long int instead of int. In this problem, in my opinion, int is enough. I check, and for int is WA. I don’t know were is bug, I’m don’t read your code carefully yet [sorry I’m heven’t got AC in this problem].