-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathA - Level Statistics
35 lines (31 loc) · 927 Bytes
/
A - Level Statistics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
while(x-- >0){
int r = sc.nextInt();
int pp =0;
int cc =0;
int d=0;
while(r-- >0){
int p= sc.nextInt();
int c= sc.nextInt();
if((p<c||p<pp)||c<cc||(pp-cc)>(p-c)){
d=1;
}
pp=p;
cc=c;
}if(d==0){
System.out.println("Yes");
}else
System.out.println("NO");
}
}}