View Code of Problem 6

#include <stdio.h>

int cmp(int a,int b)
{

}
int main(void)
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int i = 0,j,st,ed,start[100]={0},max = 0,n;
        scanf("%d",&n);
        while(n--)
        {
            scanf("%d%d",&st,&ed);
            max = max > (ed - st) ? max :(ed - st);
            start[i++] = st;
        }
        for(j = 0;j < i - 1;j++)
        {
            if(start[j] + max > start[j + 1])
            {
                printf("NO\n");
                break;
            }
        }
        if(j == i - 1)
            printf("YES\n");
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 6