why is the following showing wrong answer on codechef though it gives the correct answer for the test cases provided and several other cases that i fed into the program. Here is the question:
http://www.codechef.com/problems/MAXCOUNT
and here is the code
#include<stdio.h>
#include<string.h>
int main()
{
int t,n,a,num[10001],freq,val;
scanf("%d",&t);
while(t--)
{
memset(num,0,10001);
scanf("%d",&n);
freq=0;
val=0;
for(int i=0;i<n;i++)
{
scanf("%d",&a);
num[a]++;
if(freq<num[a])
{
freq=num[a];
val=a;
}
}
printf("%d %d\n",val,freq);
}
}