#C3580. List Operations Manipulation
List Operations Manipulation
List Operations Manipulation
You are given an initially empty list and a sequence of operations to perform on it. There are three types of operations:
insert x y
: Insert the integer (y) at position (x) of the list.get x
: Retrieve the integer at position (x) of the list and output it.delete x
: Remove the element at position (x) from the list.
The total number of operations is (n). Your task is to simulate these operations and print the results of all the get
operations in the order they appear. Note that the list indices start from 0. This problem tests your ability to manipulate arrays or lists according to a sequence of instructions.
inputFormat
The first line contains a single integer (n), which is the number of operations. The next (n) lines each contain an operation in one of the following formats:
insert x y
get x
delete x
All operations are valid and the indices used will be within the current bounds of the list.
outputFormat
For each get x
operation, output the integer at the specified index on a new line in the order the operations occur.## sample
7
insert 0 5
insert 1 10
insert 2 15
get 1
delete 1
get 1
insert 1 20
10
15
</p>