You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
658 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> v1;
for (int i = 0; i < n; i++) {
v1.push_back(i + 1);
}
for (int i = 0; i < m; i++) {
int p, q;
cin >> p >> q;
//3 2 :表示第3个位置同学出列向后移动2个距离
//(1)出列即删除
int xuehao = v1[p - 1]; //学号
v1.erase(v1.begin() + p - 1);
//(2)移动就是插入
v1.insert(v1.begin() + p - 1 + q, xuehao);
}
for (int i = 0; i < n; i++) {
cout << v1[i] << " ";
}
cout << endl;
return 0;
}