QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#7969. 套娃

الإحصائيات

题目描述

我们定义一个集合的 $\operatorname{mex}$ 是最小的不在 $S$ 中的非负整数。

给定一个序列 $a_1,\dots,a_n$,对于每个 $1\leq k\leq n$,我们按照如下方式定义 $b_k$:

  • 对于 $a$ 的所有长为 $k$ 的子区间,求出这个子区间构成的数集的 $\operatorname{mex}$。
  • 对于求出的所有 $\operatorname{mex}$,求出这个数集自己的 $\operatorname{mex}$,记为 $b_k$。

请你求出序列 $b$。

输入格式

从标准输入读入数据。

第一行输入一个正整数 $n$($1\leq n\leq 10^5$)。

第二行输入 $n$ 个整数 $a_1,\dots,a_n$($0\leq a_i\leq n$)。

输出格式

输出到标准输出。

一行输出 $n$ 个整数 $b_1,\dots,b_n$。

样例1输入

6
0 0 0 1 2 3

样例1输出

2 3 4 0 0 0
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.