#P15776. [JAG 2025 Summer Camp #2] All Copy Paste
[JAG 2025 Summer Camp #2] All Copy Paste
题目描述
You have a sequence of length , where initially for all (). There are queries. In the -th query, an integer () is given and you replace with
$$(A_1, A_2, \ldots, A_{x_q}, A_1, A_2, \ldots, A_{|A|}, A_{x_q + 1}, A_{x_q + 2}, \ldots, A_{|A|}), $$where denotes the current length of . In other words, you insert a copy of the entire sequence right after its first elements.
After processing all queries in order, output the first elements of the resulting sequence .
输入格式
The input is given in the following format.
$$\begin{aligned} & N \ M \ Q \\ & x_1 \\ & x_2 \\ & \vdots \\ & x_Q \end{aligned} $$The first line contains three integers , , and (, , ). Each of the following lines contains one integer (), representing the parameter of the -th query.
输出格式
Print integers , the first elements of the final sequence after all queries are applied, in a single line separated by spaces.
5 9 2
2
6
1 2 1 2 3 4 1 2 1
200000 10 10
234
54
2346
374
6
24
547
65
20000000
74
1 2 3 4 5 6 1 2 3 4