import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); int a[] = new int[n]; int max = 0; for (int j = 0; j < n; j++) { int l = sc.nextInt(); int r = sc.nextInt(); if (r-l > max) max = r - l; a[j] = l; } for (int k = 0; k < n-1; k++) { if (a[k] + max > a[k + 1]) System.out.println("NO"); else System.out.println("YES"); } } } } |
Double click to view unformatted code.