MAJOR - Majority

题意翻译

有$t$组数据,每组数据中有$n$个数,问有没有一个数它在数据中出现的个数超过$n$的一半,有就输出$“YES”$,再输出这个数,否则输出$“NO”$。 ## 输入格式 输入的第一行包含测试用例$t(1<=t<=100)$。它后面是$2*t$行,每个测试用$2$行。第一行输入包含一个数字$n(0<=n<=$10^6$)$,然后在下一行添加n个元素。每个数字从-10^3~10^3。 ## 输出格式 如果发送成功,则需要输出“YES”,然后输出发送的号码,否则输出“NO”。

题目描述

The human tribe has just discovered some other tribe and wants to communicate with them. To make sure it is not intercepted by the terminators, they ask their chief computer engineer Rohit to design a system for the purpose. In the design that Rohit proposes, data is transmitted n times. If it is received more than half-the times, it is said to be successfully transmitted. If not, the data is said to be lost. Rohit obviously got a lot of fame and respect for his work. Nitish doesn’t like it and wants to challenge Rohit’s supremacy. He wants to check out the system and has hired you for the process.

输入输出格式

输入格式


The first line of the input contains test cases t (1 <= t <= 100). It is followed by 2\*t lines, 2 for each test case. The first line of input for each test case contains a number n (0 <= n <= 10 $ ^{6} $ ), followed by n elements in the next line. Each number is from -10^3 to +10^3

输出格式


You are required to output ‘YES’ followed by the number transmitted, if it was transmitted successfully, and ‘NO’ otherwise.

输入输出样例

输入样例 #1

3
4
2 1 2 2
6
1 1 1 2 2 2
5
1 2 4 5 1

输出样例 #1

YES 2
NO
NO