report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Insert - MarisaOJ: Marisa Online Judge

Insert

Time limit: 1000 ms
Memory limit: 256 MB
You are given an integers array $A$ of length $n$ and $q$ queries of form $i \\; x$, insert value $x$ at position $i$ of $A$. Print array $A$ after each query. ### Input - The first line contains 2 integers $n, q$. - The second line contains $n$ integers $A_i$. - Each line in the next $q$ line contains 2 integers $i \\; x$ denotes a query. It is guaranteed that every query is valid. ### Output - Print $q$ line, $i^{th}$ line is the array $A$ after $i^{th}$ query. ### Constraints - $1 \le n, q \le 100$. - $|A_i|, |x| \le 100$. ### Example Input: ``` 3 3 1 2 3 1 0 5 5 5 4 ``` Output: ``` 0 1 2 3 0 1 2 3 5 0 1 2 3 4 5 ```
Array
Even elements
Smallest value
Average
Array reversal
Negative and positive
Consecutive differences
Largest value
Positive and negative
Dominant element
Second largest
Maximum product
Array rotation
Palindrome array
Circle
Insert
Positive subarray
Sorting
Similar Arrays
Unique
Unique 2
Frequent value
Most Frequent Value
Bitonic sequence
Swap
Topic
Basic
Rating 800
Solution (2) Solution