CF2004A Closest Point
题目描述
考虑直线上的一个点集,$i$ 到 $j$ 的距离是 $\lvert i-j\rvert$。
$i$ 是集合中离 $j$ 最近的点,当且仅当不存在另一点 $k$,满足 $j$ 到 $k$ 的距离严格小于 $j$ 到 $i$ 的距离。换句话说,集合中其他所有点到 $j$ 的距离大于等于 $\lvert i-j\rvert$。
例如,考虑一个点集 $\{1,3,5,8\}$:
- 对于点 $1$,最近的点是 $3$(其他所有点到 $1$ 的距离大于 $\lvert 1-3\rvert=2$);
- 对于点 $3$,有两个最近的点:$1$ 和 $5$;
- 对于点 $5$,最近的点是 $3$(而不是 $8$,因为它到 $5$ 的距离大于 $\lvert 3-5\rvert$);
- 对于点 $8$,最近的点是 $5$。
给你一个点集,你必须往里面加入一个原本不存在于点集中的整数点,并使其成为点集中每个点的最近的点。你需要判断是否可能做到。
输入格式
第一行一个整数 $t(1\le t\le 1000)$,表示测试数据组数。
每一组数据包含以下两行:
- 第一行一个整数 $n(2\le n\le 40)$,表示点集的大小。
- 第二行 $n$ 个整数 $x_1,x_2,\dots,x_n(1\le x_1
输出格式
对于每一组测试数据,如果可以加入一个点满足要求,输出 `YES`;否则输出 `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.