View Code of Problem 6

#include<stdio.h>
int main()
{
	int t, n, a[100], i, j;
	long l, r;
	scanf("%d", &t);
	while (t--)
	{
		i = 0;
		scanf("%d", &n);
		while (n--)
		{
			scanf("%d %d", &l, &r);
			a[i] = r - l;
			i++;
		}
		for (j = 0; j < i - 1; j++)
		{
			if (a[j] != a[j + 1])
			{
				printf("NO\n");
				goto stop;
			}
		}
		printf("YES\n");
stop:;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 6