CF2059A Milya and Two Arrays

题目描述

我们称一个数组是“好”的,如果数组中的每个元素 $x$ 在该数组中出现了至少两次。例如,数组 $[1,2,1,1,2]$、$[3,3]$ 和 $[1,2,4,1,2,4]$ 是“好”的,而数组 $[1]$、$[1,2,1]$ 和 $[2,3,4,4]$ 不是“好”的。 Milya 有两个“好”的数组 $a$ 和 $b$,长度均为 $n$。她可以以任何方式重新排列数组 $a$ 中的元素。之后,她得到一个长度为 $n$ 的数组 $c$,其中 $c_i = a_i + b_i$($ 1 \le i \le n $)。 请判断 Milya 是否有一种重新排列数组 $ a $ 的方法,使得数组 $ c $ 中有至少 $ 3 $ 种不同的元素。

输入格式

每个测试点包含多组测试。第一行包含一个整数 $ t $ ($ 1 \le t \le 1000 $),表示测试点的测试组数。 每个测试组的第一行包含一个整数 $ n $($ 3 \le n \le 50 $),表示数组 $ a $ 和 $ b $ 的长度。 每个测试组的第二行包含 $ n $ 整数 $ a_1, a_2, \ldots, a_n $($ 1 \le a_i \le 10^9 $),表示数组 $ a $。 每个测试用例的第三行包含 $ n $ 整数 $ b_1, b_2, \ldots, b_n $($ 1 \le b_i \le 10^9 $),表示数组 $ b $。

输出格式

对于每个测试组,有一种重新排列数组 $ a $ 的方法,使得数组 $ c $ 中有至少 $ 3 $ 种不同的元素。则输出 `yes`(任一字母均可大写),反则输出 `no`(任一字母均可大写)。

说明/提示

In the first test case, you can swap the second and third elements. Then the array $ a = [1, 1, 2, 2] $ , $ b = [1, 2, 1, 2] $ , and then $ c = [2, 3, 3, 4] $ . In the second test case, you can leave the elements unchanged. Then $ c = [2, 3, 4, 4, 3, 2] $ . In the third test case, the array $ a $ will not change from rearranging the elements in it. Then $ c = [2, 2, 2] $ , so the answer is $ « $ NO $ » $ .