i don’t understand why my code is giving wrong answer it is producing correct results for all test cases provided at question page and in forums… please help
#include <stdio.h>
int main()
{
int i,j,A[10000],Q[10000],n,t,k,c,maxc;
scanf("%d", &t);
for (i = 0; i < t; ++i)
{
for (j = 0; j < 10000; ++j)
{
A[j]=0;
Q[j]=0;
}
scanf("%d",&n);
for (j = 0; j < n; ++j)
{
scanf("%d", &A[j]);
Q[A[j]]++;
}
k=10000;
c=0;
while(k--)
{
if (Q[k]>0&&c<=Q[k])
{
c=Q[k];
maxc=k;
}
}
printf("%d %d\n", maxc, c);
}
return 0;
}