当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7146:Laser

题目描述
There are $n$ enemies on a two-dimensional plane, and the position of the i-th enemy is ($x_i$,$y_i$)

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\leq 10^5)$ 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 integers $x_i, y_i(-10^8 \leq x_i,y_i \leq 10^8)$ 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

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7146

最后修改于 2022-09-15T06:17:01+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 524288/524288K(Java/Others)