#include<stdio.h>
#include<string.h>
#include<malloc.h>
void work() {
    int n,max,maxpos,x,i;
    scanf("%d",&n);
    int *arr=(int*) malloc(sizeof(int)*2005);
    memset(arr,0,2005);
    max=maxpos=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&x);
        arr[x+1000]++;
        if(arr[x+1000]>max)
        {
            max=arr[x+1000];
            maxpos=x;
        }
    }
    if(max>n/2)
        printf("YES %d\n",maxpos,max);
    else
    printf("NO\n");
}
int main() {
    int t;
    scanf("%d",&t);
    while(t--)
        work();
    return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to