#include <stdio.h>
#include <stdlib.h>

//void solution();

int main(void)
{
int testSet;
int heads;
int *arr, *check;
int j,i, imax, imin;
int position;
int answer;

scanf("%d",&testSet);


for(j=0;j<testSet;j++) {

scanf("%d",&heads);

arr = (int*)malloc(heads*sizeof(int));
check = (int*)calloc(heads, sizeof(int));

for(i=0;i<heads;i++)
scanf("%d",&arr[i]);

position = 0; 
while(position<heads) {
imax = position;
for(i=position;i<heads;i++) 
if(arr[i]-1 >= i-position && arr[i]>=arr[position]) {
imax = i;
};
++check[imax];
if(imax == heads-1) break;
if(imax!=position)
position = imax;
else position += arr[position];
if(arr[position]+position>heads) break;
}


answer = 0;
for(i=0; i<heads; i++) 
// if(check[i])  ++answer;
printf("%-2d",check[i]);

free(arr);
free(check);
printf("%d\n",answer);
}

return 0;
}

+ Recent posts