View Code of Problem 6

//jlh的童年1
#include <cstdio>
struct len{
	int l;
	int r;
};
int main(){
	int t;
	scanf("%d",&t);
	int i;
	for(i=0;i<t;i++){
		int n;
		scanf("%d",&n);
		int j;
		len trap[n];
		for(j=0;j<n;j++){
			scanf("%d%d",&trap[j].l,&trap[j].r);
		}
		int dis=trap[0].r-trap[0].l;
		int k;
		for(k=1;k<n;k++){
			int temp=trap[k].r-trap[k].l;
			if(dis<temp){
				printf("NO");
				break;
			}
		}
		if(k==n){
			printf("YES");

		}
		
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 6