Consider a set of points on a line. The distance between two points $$$i$$$ and $$$j$$$ is $$$|i - j|$$$.
The point $$$i$$$ from the set is the closest to the point $$$j$$$ from the set, if there is no other point $$$k$$$ in the set such that the distance from $$$j$$$ to $$$k$$$ is strictly less than the distance from $$$j$$$ to $$$i$$$. In other words, all other points from the set have distance to $$$j$$$ greater or equal to $$$|i - j|$$$.
For example, consider a set of points $$$\{1, 3, 5, 8\}$$$:
You are given a set of points. You have to add an integer point into this set in such a way that it is different from every existing point in the set, and it becomes the closest point to every point in the set. Is it possible?
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases.
Each test case consists of two lines:
For each test case, print YES if it is possible to add a new point according to the conditions from the statement. Otherwise, print NO.
323 825 661 2 3 4 5 10
YES NO NO
In the first example, the point $$$7$$$ will be the closest to both $$$3$$$ and $$$8$$$.
In the second example, it is impossible to add an integer point so that it becomes the closest to both $$$5$$$ and $$$6$$$, and is different from both of them.
Name |
---|