#include <iostream> #include <string> #include <cstring> #include <cmath> #include <cstdio> #include <vector> #include <algorithm> #include <cstdlib> #include <queue> using namespace std; int main() { int m, n, t, flag; int i, j, k; cin >> t; while (t--) { flag = 0; cin >> n; int a[100], b[100]; int s[100]; int max = 0; for (i = 0; i < n; i++) { cin >> a[i] >> b[i]; s[i] = b[i] - a[i]; if (s[i] > max) max = s[i]; } for (i = 0; i < n - 1; i++) { if (max > a[i + 1] - a[i]) { flag = 1; break; } } if (flag==0) cout << "YES" << endl; else cout << "NO" << endl; } return 0; } |
Double click to view unformatted code.