题解 | 【模板】序列操作
【模板】序列操作
https://www.nowcoder.com/practice/12da4185c0bb45918cfdc3072e544069
seq=[]
num=int(input())
for _ in range(num):
parts=input().split()
op=int(parts[0])
if op==1:
x=int(parts[1])
seq.append(x)
elif op==2:
seq.pop()
elif op==3:
i=int(parts[1])
print(seq[i])
elif op==4:
i=int(parts[1])
x=int(parts[2])
seq.insert(i+1,x)
elif op==5:
seq.sort()
elif op==6:
seq.sort(reverse=True)
elif op==7:
print(len(seq))
elif op==8:
print(' '.join(map(str,seq)))
