#include
#include
#include
using namespace std;
struct room
{
int s;
int t;
bool selected;
}rooms[210];
int cmp( const void *a , const void *b )
{
struct room *c =(room *)a;
struct room *d =(room *)b;
if(c->s!=d->s)
return c->s-d->s;
else
return c->t-d->t;
}
int main()
{
int i,j,n,sum,m,ri,repeat,temp;
cin>>repeat;
for(ri=0;ri
sum=0;
cin>>n;
for(i=0;i
cin>>rooms[i].s>>rooms[i].t;
rooms[i].selected = false;
if(rooms[i].s>rooms[i].t)
{
temp=rooms[i].s;
rooms[i].s=rooms[i].t;
rooms[i].t=temp;
}
}
qsort(rooms,n,sizeof(rooms[0]),cmp);
while(1)
{
j=0;
while(j
sum++;
rooms[j].selected = true;
for(i=j+1;i
if(rooms[i].selected) continue;
if(!((rooms[j].t+1==rooms[i].s&&rooms[j].t%2!=0)||(rooms[j].t>=rooms[i].s)))
{
rooms[i].selected = true;
j=i;
}
}
}
cout<
return 0;
}