#include<iostream>
using namespace std;
#pragma GCC optimize(2)
struct ListNode {
int value;
ListNode* next;
ListNode(int val) :value(val), next(NULL) {};
ListNode() :value(0), next(NULL) {};
};
void _insert(ListNode* head, int pos, int value) {
ListNode* pre = head, * cur = head;
for (int i = 0; i <= pos; ++i) {
pre = cur;
cur = cur->next;
}
ListNode* to_insert = new ListNode(value);
pre->next = to_insert;
to_insert->next = cur;
}
void _delete(ListNode* head, int pos) {
ListNode* pre = head, * cur = head;
for (int i = 1; i <= pos; ++i) {
pre = cur;
cur = cur->next;
}
pre->next = cur->next;
cur = cur->next;
}
int main() {
int n, m;
scanf("%d %d", &n, &m);
ListNode* head = new ListNode(),*cur = head;
for (int i = 0; i < n; i++) {
int t;
cin >> t;
ListNode* tmp = new ListNode(t);
cur->next = tmp;
cur = cur->next;
}
int c;
for (int i = 0; i < m; ++i) {
cin >> c;
if (c == 1) {
int insert_value,pos;
scanf("%d %d", &pos, &insert_value);
_insert(head, pos, insert_value);
}
else {
int pos;
cin >> pos;
_delete(head, pos);
}
}
ListNode* p = head->next;
while (p) {
printf("%d ",p->value);
p = p->next;
}
return 0;
}
AC后是错的