View Code of Problem 6

#include <iostream>
int main()
{
	int T,flag;
	std::cin >> T;
	int num[101];
	while (T--) {
		int n;
		flag = 0;
		std::cin >> n;
		for (int i = 0; i < n; i++) {
			int l, r;
			std::cin >> l >> r;
			num[i] = r - l;
		}
		for (int j = 0; j < n; j++) {
			if (num[0] != num[j]) {
				std::cout << "NO";
				flag = 1;
			}
		}
			if (flag == 0) {
			std::cout << "YES";
			}
			if (T != 0) {
			  std::cout << "\n";
			}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 6