count of maximum | giving wrong answer despite of several fruitfull test cases

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;
    }

the problem is with the array size . Increase the array size . Here is the link for the accepted code
http://www.codechef.com/viewsolution/3646514

1 Like

oooohh ok i got it, actually 10000 is not included as per the question.

//