Activity selection problem

Submission #16237256

can;t understand whats wrong in this

hi @snehacpcb_6a154f5c45187387 u can do is simple without using any extra space for queue
refer

#include<bits/stdc++.h>
using namespace std;

bool cmp(pair<int,int> l , pair<int,int> r){
    return(l.second < r.second);
}

int main() {
	int t;
	cin>>t;
	
    vector<pair<int,int> >v;

    while(t--){
		int n;
		cin>>n;

		for(int i=0;i<n;i++){
			int s,e;
			cin>>s>>e;
			v.push_back(make_pair(s,e));
		}

	   sort(v.begin(),v.end(),cmp);
	   int sum=1;
	   int finish = v[0].second;

	   for(int i=1;i<n;i++){
		   if(v[i].first >= finish){
			   finish = v[i].second;
			   sum++;
		   }
	   }

	   cout<<sum<<endl;
	   v.clear();
	}
	return 0;
}

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.