When I used multimap it gives wrong but when I used multiset it gives AC, What is the difference in code it made WA https://www.codechef.com/viewsolution/37179813 and AC https://www.codechef.com/viewsolution/37179834.
Use a map<int,vector> with h as key and store the corresponding x in vector. Sort the vector and apply lower bound in it and the check for the conditions u did in your code. I hope this helps, if not I will provide u with the code.
I am not asking for this bro , read my doubt please .