F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Laser

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 2144    Accepted Submission(s): 583


Problem Description
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.
 

Input
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
 

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

Sample Input
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
 

Sample Output
YES NO
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-10 07:16:02, Gzip enabled