/********************************************* Problem : HDU Bestcoder Author : NMfloat InkTime (c) NM . All Rights Reserved . ********************************************/ #include #include #include #include #include #include #include #include #include #include #define rep(i,a,b) for(int i = a ; i <= b ; i ++) #define rrep(i,a,b) for(int i = b ; i >= a ; i --) #define repE(p,u) for(Edge * p = G[u].first ; p ; p = p -> next) #define cls(a,x) memset(a,x,sizeof(a)) #define lson rt<<1 #define rson rt<<1|1 using namespace std; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; const int MAXN = 5e4+5; const int MAXE = 2e5+5; typedef long long LL; int T,n,m,k; struct Node { int x,y; int value; }t[MAXN<<2]; void Push_Up(int rt) { t[rt].value = t[lson].value + t[rson].value; } void Build(int x,int y,int rt) { t[rt].x = x ; t[rt].y = y; if(x == y) { t[rt].value = 1; return ; } int mid = (x + y) >> 1; Build(x,mid,lson); Build(mid+1,y,rson); Push_Up(rt); } void Update(int rt,int pos) { if(t[rt].x == t[rt].y) { t[rt].value = 0; return ; } int mid = (t[rt].x + t[rt].y) >> 1; if(mid >= pos) Update(lson,pos); else Update(rson,pos); Push_Up(rt); } int ANS; void Query(int rt,int k) { if(t[rt].x == t[rt].y) { ANS = t[rt].x; return ; } int mid = (t[rt].x + t[rt].y) >> 1; if(t[lson].value >= k) Query(lson,k); else Query(rson,k - t[lson].value); } int num[MAXN]; int ans[MAXN]; void input() { scanf("%d",&n); Build(1,n,1); rep(i,1,n) { scanf("%d",&num[i]); } rrep(i,1,n) { num[i] = num[i] - num[i-1]; } rrep(i,1,n) { int k = i - num[i]; Query(1,k); ans[i] = ANS; Update(1,ans[i]); } rep(i,1,n) { printf("%d",ans[i]); if(i == n) printf("\n"); else printf(" "); } } void solve() { } int main(void) { //freopen("a.in","r",stdin); scanf("%d",&T); while(T--) { //while(~scanf("%d %d",&n,&m)) { input(); solve(); } return 0; }