#include <iostream>
#include <algorithm>
struct Node
{
int a, b;
Node(){}
Node(int x,int y )
:a(x),b(y)
{}
bool operator<(Node& Item )
{
if ( a== Item.a )
return b< Item.b;
return a< Item.a;
}
};
Node data[200];
int n;
bool visite[200];
int main()
{
int test;
scanf("%d", &test );
while( test-- )
{
scanf("%d",&n);
for ( int i= 0; i< n; ++i )
{
int x,y;
scanf("%d%d",&x,&y);
if ( x> y ) std::swap (x,y);
data[i]= Node(x,y);
}
std::sort( data, data+ n );
memset( visite, false, sizeof(visite) );
int count= 0;
for ( int i= 0; i< n; ++i )
{
if ( !visite[i] )
{
int temp= data[i].b;
for ( int j= i+ 1; j< n; j++ )
if ( !visite[j] && data[j].a> temp &&
!( data[j].a- temp== 1 && !(data[j].a&1) ) )
{
visite[j]= true;
temp= data[j].b;
}
count++;
}
}
printf("%d\n", count* 10 );
}
return 0;
}
posted on 2008-10-03 11:10
Darren 阅读(208)
评论(0) 编辑 收藏 引用