#include <map>
#include <set>
#include <list>
#include <cmath>
#include<cctype>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b)
{
return a % b == 0 ? b : gcd(b, a % b);
}
struct node
{
int l,r;
friend bool operator < (const node &a,const node &b)
{
if (a.l==b.l) return a.r<b.r;
return a.l<b.l;
}
}src[205];
bool vis[205];
int N;
void slove()
{
sort(src,src+N);
memset(vis,false,sizeof(vis));
int ans=0;
for (int i=0;i<N;i++)
{
if (vis[i])continue;
vis[i]=true;
ans++;
int j=i+1;
int tmp=src[i].r;
while (j<N)
{
if (src[j].l>tmp && !vis[j]) {vis[j]=true;tmp=src[j].r;}
j++;
}
}
printf("%d\n",ans*10);
}
int main()
{
//freopen("sample.txt","r",stdin);
int T;
scanf("%d",&T);
while (T--)
{
scanf("%d",&N);
for (int i=0;i<N;i++)
{
int a,b;
scanf("%d%d",&a,&b);
a=(a+1)/2;
b=(b+1)/2;
if (a>b)swap(a,b);
src[i].l=a;
src[i].r=b;
}
slove();
}
return 0;
}
UVALIVE 2326 moving tables 不相交区间问题
最新推荐文章于 2019-07-20 17:07:04 发布