学生排队
![在这里插入图片描述](https://img-blog.csdnimg.cn/7c5333b40174464687a6f23368000c29.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBARGVzVmlld2Vy,size_20,color_FFFFFF,t_70,g_se,x_16)
#include<bits/stdc++.h>
using namespace std;
/*int findwhere(vector<int> &a,int x){
for(int i = 0; i < a.size();i++){
if(a[i] == x){
return i;
}
}
}*/
int main(){
int n;
cin>>n;
int a[n];
for(int i = 0; i < n; i++){
a[i] = i+1;
}
int m;
cin>>m;
int where;
while(m){
int p,q;
cin>>p>>q;
/*int where = findwhere(a,p);
cout<<where<<endl;*/
for(int i = 0; i < n;i++){
if(a[i] == p){
where = i;
break;
}
}
if(q < 0){
for(int i = where;i>where+q;i--){
a[i] = a[i-1];
}
a[where+q] = p;
}
else{
for(int i = where;i<where+q;i++){
a[i] = a[i+1];
}
a[where+q] = p;
}
m--;
}
for(int i = 0; i < n;i++){
cout<<a[i]<<" ";
}
}