贪心。。
#include<iostream>
#include<string.h>
#include<math.h>
#include <stdio.h>
#include <algorithm> using namespace std; struct node
{
int s,t;
int m;
}; node a[]; int cmp(node a,node b)
{
return a.m<b.m;
} int main()
{
int n;
int i,j;
int now;
while(scanf("%d",&n)!=EOF)
{
if(n==)
break;
for(i=;i<n;i++)
{
scanf("%d%d",&a[i].s,&a[i].t);
if((a[i].t-a[i].s)%==)
a[i].m=a[i].s+(a[i].t-a[i].s)/-;
else
a[i].m=a[i].s+(a[i].t-a[i].s)/;
}
sort(a,a+n,cmp);
now=;
int flag=;
int cnt=;
for(i=;i<n;i++)
{
if(now>a[i].m)
{
flag=;
break;
}
else if(now<=a[i].s)
now=a[i].s+(a[i].t-a[i].s)/+;
else if(now>a[i].s)
now=now+(a[i].t-a[i].s)/+;
cnt++;
} if(flag)
printf("NO\n");
else
{
if(cnt==n)
printf("YES\n");
else
printf("NO\n");
}
}
return ;
}