You start with an array A of size N. Also, A[i] = 0 for i = 1 to N. You will be given K positive integer. Let s be one of these integers, you have to add 1 to all A[i], for i >= j. Your task is to print the array A after all these K updates are done.
_____________________________________________
t = int(input())
for i in range(t):
n,m=list(map(int,input().split()))
a=[0]*n
arr=list(map(int,input().split()))
for j in range(m):
for j in range(arr[j]-1,int(n)):
a[j] += 1
print(*a)
_____________________________________________
Comments
Post a Comment