"""
测试用例
8
3
3 2
8 -3
3 -2
"""
n = int(input())
m = int(input())
Q = [i+1 for i in range(n)] # 队列
for i in range(m):
p, q = list(map(int, input().split()))
t = Q.index(p)
if q > 0:
for j in range(1,q+1):
Q[t+j-1] = Q[t+j]
Q[t+q] = p
if q < 0:
for j in range(1,1-q):
Q[t-(j-1)] = Q[t-j]
Q[t+q] = p
print(" ".join(map(str, Q)))
CCF 201703-2 学生排队 python
最新推荐文章于 2022-05-26 10:34:19 发布