Start: Jul, 05, 2019 08:40:00
2019年度暑期短学期达标测试
End: Jul, 05, 2019 11:40:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 4ms
Memory: 1120kB
Author: CT12812581281
In contest: 1281

#include <stdio.h>
#include<string.h>
int main()
{  int t,i,j,a,b,m=1,flag=0;;
   int d[1000][10];
   
   scanf("%d",&t);
   scanf("%d %d",&d[1][1],&d[1][2]);
   t=t-1;
   while(t--)
   {
	   scanf("%d %d",&a,&b);
	   for(i=1;i<=m;i++)
	   {
	   if(a<=d[i][1]&&b<=d[i][2])
	   {
		   d[i][1]=a;
		   d[i][2]=b;
		   flag=1;
		   break;
	   }
	   else if(b<=d[i][1]&&a<=d[i][2])
	   {	d[i][1]=b;
			d[i][2]=a;
			flag=1;
		    break;
	   }
	   }
	   if(flag==0) {m=m+1;d[m][1]=a;d[m][2]=b;}
	   flag=0;

   }
   printf("%d",m);

    return 0;
}