https://www.codechef.com/viewsolution/52399535
int a[10]={0};
t (what you are calling n) can be as high as 10^6.
n