Test case 0 is not passing

// Activity selection problem

#include
#include
using namespace std;

bool compare(pair<int,int> a,pair<int,int> b)
{
return a.second<b.second;
}

int main() {

int job=1;
int t; //test cases
cin>>t;

while(t>0)
{
int n;
// cout<<“enter the number of activities\n”;

cin>>n;
pair<int,int>act[n];
for(int i=0;i<n;i++)
{

cin>>act[i].first;
cin>>act[i].second;
}

sort(act,act+n,compare);

// for(int i=0;i<n;i++)
// {
// cout<<act[i].first<<" "<<act[i].second<<endl;
// }

// cout<<endl;
int last_ended=act[0].second;

for(int i=1;i<n;i++)
{
if(act[i].first>=last_ended)
{
// cout<<act[i].first<<" "<<act[i-1].second<<endl;

    job++;
    last_ended=act[i].second;
}

}

t–;
}

cout<<job<<endl;

return 0;
}

plz share the link of your code
save at https://ide.codingblocks.com/
file->save
and share the link generated

problem is solved thnkyou

okay good

keep learning

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.