View Code of Problem 6

#include<bits/stdc++.h>
using namespace std;
int main(){
	int len=0,l,r;
	int flag=1;//可以完成 
	int t,n;
	cin>>t;
	 while(t--){
	 	int ans=0;
	 	cin>>n;
	 	cin>>l>>r;
	 	len=r-l;
	 	int k=n-1; 
	 	while(k--){
	 		cin>>l>>r;
	 		if(len<r-l)flag=0;
	 		len=r-l;
	 		if(flag==0)cout<<"NO"<<endl;
			 else cout<<"YES"<<endl; 
	 	}	
	 	
	 }
	return 0;
} 

Double click to view unformatted code.


Back to problem 6