#P9970. [THUPC 2024 初赛] 套娃
[THUPC 2024 初赛] 套娃
Problem Description
We define the of a set as the smallest non-negative integer that is not in .
Given a sequence , for each , we define in the following way:
- For all subarrays of with length , compute the of the set of numbers in that subarray.
- For the set of all computed values, compute the of this set, and denote it as .
You are asked to output the sequence .
Input Format
The first line contains a positive integer ().
The second line contains integers ().
Output Format
Output integers in one line.
6
0 0 0 1 2 3
2 3 4 0 0 0
Hint
Problem Usage Agreement
From the THUPC2024 (Tsinghua University Student Programming Contest and Collegiate Invitational Contest 2024) preliminary round.
The following "this repository" all refer to the THUPC2024 preliminary round official repository (https://github.com/ckw20/thupc2024_pre_public).
-
Any organization or individual may use or repost the problems in this repository for free.
-
When using the problems in this repository, any organization or individual should do so for free and publicly. It is strictly forbidden to use these problems for profit or to add special access permissions to these problems.
-
If possible, when using the problems in this repository, please also provide ways to obtain resources such as testdata, reference solutions, and editorials. Otherwise, please attach the GitHub link of this repository.
Translated by ChatGPT 5