#include<iostream> using namespace std; int main() { int T, n; cin >> T; if(T == 0) { return 0; } while (T--) { cin >> n; if(n == 0) { return 0; } int flag = 1; int l, r; cin >> l; cin >> r; int temp = r - l; while (--n) { cin >> l; cin >> r; int out = r - 1; if (out != temp) { flag = 0; } } if (flag == 0) { cout << "NO\n"; } else { cout << "YES\n"; } } return 0; } |
Double click to view unformatted code.