Getting wrong answer in weighted activity selection(RENT) from SPOJ

I was attempting RENT problem from SPOJ, this problem is same as weighted activity selection problem. My solution is not getting accepted and I am getting the wrong answer. I am not able to figure out what is wrong with my code. Anyone please look at it and let me no what is the problem.

Thanks in advance :wink:

Sort it according to end time and it’ll probably turn to AC.

@vivek_1998299

I have sorted it according to the end time only.

My code is just a c++ version of ur code,however it passes.

https://ide.geeksforgeeks.org/vebuSwqZKp

@vivek_19982995

Can you please point out what is wrong with my code.