fork download
  1. import copy
  2. T = int(input())
  3. while T:
  4. N = int(input())
  5. A = [int(i) for i in input().split()]
  6. B = copy.deepcopy(A)
  7. for i in range(1, N):
  8. tmp = A[i]
  9. j = i-1
  10. while j >=0 and tmp < A[j] :
  11. A[j + 1] = A[j]
  12. j -= 1
  13. A[j+1] = tmp
  14. #print(A)
  15. #print(A)
  16. for i in range(1, N):
  17. #print(B[i], end = " ")
  18. print(A.index(B[i]), end = ' ')
  19. print()
  20. T -= 1
Success #stdin #stdout 0.02s 9236KB
stdin
4
8
176 -272 -272 -45 269 -327 -945 176 
2
-274 161
7
274 204 -161 481 -606 -767 -351
2
154 -109
stdout
2 2 4 7 1 0 5 
1 
4 3 6 1 0 2 
0