codeforces#P1364C. Ehab and Prefix MEXs
Ehab and Prefix MEXs
Description
Given an array of length , find another array, , of length such that:
- for each , , , .
The of a set of integers is the smallest non-negative integer that doesn't belong to this set.
If such array doesn't exist, determine this.
The first line contains an integer () — the length of the array .
The second line contains integers , , , () — the elements of the array . It's guaranteed that for .
If there's no such array, print a single line containing .
Otherwise, print a single line containing integers , , , ()
If there are multiple answers, print any.
Input
The first line contains an integer () — the length of the array .
The second line contains integers , , , () — the elements of the array . It's guaranteed that for .
Output
If there's no such array, print a single line containing .
Otherwise, print a single line containing integers , , , ()
If there are multiple answers, print any.
Samples
Note
In the second test case, other answers like , for example, are valid.