P27151 [AtCoder] Neq Min
入门
题目描述

Problem Statement

Given is a number sequence of length N: p_1, ..., p_N.
For each i=1, 2, ..., N, find the minimum non-negative integer that is not equal to any of the numbers p_1, ..., p_i.

Input

Input is given from Standard Input in the following format:
N
p_1 ... p_N

Output

Print N lines in total.
The $i-th line (1 \leq i \leq N)$ should contain the minimum non-negative integer that is not equal to any of the numbers p_1, ..., p_i.

Constraints

  • $1 \leq N \leq 200,000$
  • $0 \leq p_i \leq 200,000$
  • All values in input are integers.

Sample Input 1

4
1 1 0 2

Sample Output 1

0
0
2
3

  • The minimum non-negative integer that is not equal to p_1=1 is 0.
  • The minimum non-negative integer that is not equal to any of p_1=1, p_2=1 is 0.
  • The minimum non-negative integer that is not equal to any of p_1=1, p_2=1, p_3=0 is 2.
  • The minimum non-negative integer that is not equal to any of p_1=1, p_2=1, p_3=0, p_4=2 is 3.

Sample Input 2

10
5 4 3 2 1 0 7 7 6 6

Sample Output 2

0
0
0
0
0
6
6
6
8
8

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 1 1 0 2
样例输出
0 0 2 3