can you why it is tle;
tc is o(nlogn)
Help me out in this problem
Yes, let me go through your code
hey try this approach to tackle the tle
@aa1 you simply give me solution can you do one things what optimisation can be done in my code to overcome tle?
he culprit is distance which is taking O(N). Check the complexity here: http://www.cplusplus.com/reference/iterator/distance/
you could use vectors instead of multisets