Result: Accepted
Time: 4ms
Memory: 1120kB
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
struct shu
{
int a;
int b;
};
int main()
{
struct shu get[1000],get2[1000];
int n,p = 1;
scanf("%d",&n);
for(int i = 0;i < n;i++)
{
scanf("%d%d",&get[i].a,&get[i].b);
}
get2[0] = get[0];
for(int i = 1;i < n;i++)
{
int k = 1;
for(int j = 0;j < p;j++)
{
if((get[i].a <= get2[j].a&&get[i].b <= get2[j].b)||(get[i].a <= get2[j].b&&get[i].b <= get2[j].a))
{
get2[j] = get[i];
k = 0;
break;
}
}
if(k == 1)
{
get2[p++] = get[i];
}
}
printf("%d\n",p);
return 0;
}