Getting runtime error on submission

sol-https://ide.codingblocks.com/s/184373
ques - https://www.spoj.com/problems/BUSYMAN/

hi
firstly,you are declaring vector v globally and for every testcase the elements are being added to the previous v vector. Declare v inside the while loop for t.
Secondly, for your compare function if the end time of any two activities is same, they shouls be sorted on their start time.
so your comparator function should be like
if(p1.second==p2.second)
return p1.first<p2.first;
else
return (p1.second<p2.second);

1 Like

Thanks a lot for that finding that error!!

shall i mark this doubt as resolved?

Yes u can mark it as resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

the feedback page in not opening