1263: Laser

内存限制:512 MB 时间限制:1.000 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1 通过率:100%

题目描述

There are n enemies on a two-dimensional plane, and the position of the i-th enemy is (xi,yi)
You now have a laser weapon, which you can place on any grid (x, y)(x, y are real numbers), and the weapon fires a powerful laser that for any real number k, enemies at coordinates (x + k; y); (x; y + k); (x + k; y + k); (x + k; y - k) will be destroyed.
You are now wondering if it is possible to destroy all enemies with only one laser weapon.

输入格式

The first line of input is a positive integer T(T <= 105) representing the number of data cases.
For each case, first line input a positive integer n to represent the position of the enemy.
Next n line, the i-th line inputs two positive integers xi, yi(-108 <= xi , yi  <= 108) represents the position of the i-th enemy.
The data guarantees that the sum of n for each test case does not exceed 500,000

输出格式

For each cases, If all enemies can be destroyed with one laser weapon, output "YES otherwise output "NO"(not include quotation marks).

输入样例 复制

2
6
1 1
1 3
2 2
3 1
3 3
3 4
7
1 1
1 3
2 2
3 1
3 3
1 4
3 4

输出样例 复制

YES
NO

分类标签