#Pr154. Dynamic Array——动态数组
Dynamic Array——动态数组
Statement
Given an array of elements and operations, where each operation is one of the following, find the final array (1-based array);
- Operation 1: Insert a number after the th number;
- Operation 2: Remove the th element.
Input
The first line contains two integers , where indicates that the array contains numbers, and indicates the number of operations;
The next line contains numbers separated by spaces, where , representing the numbers stored in the array,
The following lines contain or numbers separated by spaces, where the first number represents the operation sequence number:
- If this number is , then it is followed by two numbers and , indicating that a number is inserted after the th number;
- If this number is , then it is followed by a number , indicating the deletion of the th number.
Output
Output the numbers in the array in order.
Samples
4 2
59 87 63 60
1 2 90
2 1
87 90 63 60