for _ in range(int(input())):
n=int(input());
l=list(map(int,input().split()));
lz=[0]*10;
for i in range(len(l)):
for j in range(l[i]-1,-1,-1):
lz[l[i]]+=lz[j];
lz[l[i]]+=1;
print(sum(lz));
n=int(input());
l=list(map(int,input().split()));
lz=[0]*10;
for i in range(len(l)):
for j in range(l[i]-1,-1,-1):
lz[l[i]]+=lz[j];
lz[l[i]]+=1;
print(sum(lz));
No comments:
Post a Comment