#CCBCHBAHAI0000035. Chèn giá trị vào đầu bằng dịch phải (Insert at the Front by Right Shifting)
Chèn giá trị vào đầu bằng dịch phải (Insert at the Front by Right Shifting)
Chèn giá trị vào đầu bằng dịch phải (Insert at the Front by Right Shifting)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
A static array has capacity , meaning that it can store at most elements. It currently contains the logical sequence
Insert value at the front.
- If , the array is full and insertion cannot be performed.
- If , the new logical size is and the result satisfies
Perform the insertion according to these rules.
Input
The first line contains integers . If , the second line contains integers .
Output
If , print FULL. Otherwise, print the new size on the first line and the resulting elements on the second line.
Subtask
Subtask 1 (100 points): ; ; .
Example
Input
5 3 9
1 2 3
Output
4
9 1 2 3
Explanation
Since , free capacity exists. The three old elements shift one position to the right, then is written at index .