I Have solved this problem using pair<int,int>.
It is giving me the correct output for the given example.
But at the time of submission it is giving “WRONG ANSWER”…
MY CODE IS …
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a,b;
cin>>a>>b;
pair<int,int> p= make_pair(a,b);
int count = 1;
for(int i=1;i<n;i++)
{
int a,b;
cin>>a>>b;
if(a>=p.second)
{
count++;
p.first = a;
p.second = b;
}
}
cout<<count<<endl;
}
}
