纯模拟
#include <stdio.h>
#include <string.h>
int seq[1000];
int n;
int main()
{
scanf("%d", &n);
while (n--)
{
memset(seq, 0, sizeof(seq));
int t, m, p=0, i, num= 1, j;
scanf("%d", &t);
while (t--)
{
scanf("%d", &m);
for ( i = p; num <= m; i ++ )
{
seq[i]=1;
num++;
}
seq[i]=2;
p=i+1;
}
for ( i = 0; i < p; i++ )
{
if ( seq[i] == 2 )
{
num=1;
for ( j = i-1; j >= 0 && seq[j] != 1; j-- )
if (seq[j]==3) num++;
printf("%d ", num);
seq[j]=3;
}
}
putchar(10);
}
return 0;
}