Problem list
Log in
#r03076 · Online Judge > GoldOJ

Insert Into a List

Bronze II 2.0 s 1024 MB

A list of integers is given. Then $Q$ operations follow, each a position $i$ and a value $x$ (position always valid, $0 \le i \le$ current length). Insert $x$ at position $i$ for each operation and print the final list as a Python list literal.

Input

Line 1: the list. Line 2: $Q$. Next $Q$ lines: i x.

Output

Print the resulting list.

Example 1

Input
10 20 30
3
0 5
2 15
5 40
Output
[5, 10, 15, 20, 30, 40]
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code