#include <bits/stdc++.h>
#define pb push_back
#define MAX 10000007
#define mod 100000007
#define read freopen("input.txt","r",stdin);
#define write freopen("output.txt","w",stdout);
#define inf (1<<30)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
struct node
{
int start,last;
} ary[1000];
bool cmp( node i,node j)
{
if(i.last==j.last)
{
return i.start<j.start;
}
else return i.last<j.last;
}
int main()
{
// read;
// write;
int test;
scanf("%d",&test);
while(test--)
{
int n;
scanf("%d",&n);
for(int i=0; i<n; i++)
{
scanf("%d %d",&ary[i].start,&ary[i].last);
}
sort(ary,ary+n,cmp);
int ans=0;
// for(int i=0; i<n; i++) printf("%d %d\n",ary[i].start,ary[i].last);
for(int i=0; i<n; i++)
{
int cnt=0;
for(int j=0; j<n; j++)
{
if( (ary[j].start<=ary[i].last)&&(ary[j].last>=ary[i].last)) cnt++;
}
ans=max(ans,cnt);
}
printf("%d\n",ans);
}
return 0;
}
#define pb push_back
#define MAX 10000007
#define mod 100000007
#define read freopen("input.txt","r",stdin);
#define write freopen("output.txt","w",stdout);
#define inf (1<<30)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
struct node
{
int start,last;
} ary[1000];
bool cmp( node i,node j)
{
if(i.last==j.last)
{
return i.start<j.start;
}
else return i.last<j.last;
}
int main()
{
// read;
// write;
int test;
scanf("%d",&test);
while(test--)
{
int n;
scanf("%d",&n);
for(int i=0; i<n; i++)
{
scanf("%d %d",&ary[i].start,&ary[i].last);
}
sort(ary,ary+n,cmp);
int ans=0;
// for(int i=0; i<n; i++) printf("%d %d\n",ary[i].start,ary[i].last);
for(int i=0; i<n; i++)
{
int cnt=0;
for(int j=0; j<n; j++)
{
if( (ary[j].start<=ary[i].last)&&(ary[j].last>=ary[i].last)) cnt++;
}
ans=max(ans,cnt);
}
printf("%d\n",ans);
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন