logo AlgoBeat OnlineJudge
登录 注册

#215833. [JAG 2025 Summer Camp #2] All Copy Paste

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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

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.

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.

样例

样例输入 1

5 9 2
2
6

样例输出 1

1 2 1 2 3 4 1 2 1

样例输入 2

200000 10 10
234
54
2346
374
6
24
547
65
20000000
74

样例输出 2

1 2 3 4 5 6 1 2 3 4