m,n=map(int,input().split())
A=list(map(int,input().split()))
B=[]
for i in range(n):
C=list(map(str,input().split()))
B.append(C)
for j in B:
if int(j[0])==1:
D=A[0:int(j[1])]
D.sort()
A[0:int(j[1])]=D
else:
D=A[0:int(j[1])]
D.sort(reverse=True)
A[0:int(j[1])]=D
for i in A:
print(i,end=' ')
全部评论
(1) 回帖