小塔有一个长度为n的数组[a1,a2,...,an]。现在他想知道,对于a中的每个元素,删除该元素后数组的MEX值是多少,请你帮他算算吧
整数数组的MEX定义为没有出现在数组中的最小非负整数。
第一行输入一个整数 n(2≤n≤200000)代表数组中的元素数量。
第二行输入n个整数a1,a2,...,an(0≤ai≤109)代表数组元素。
在一行输出n个整数,其中第i个整数表示删除ai后数组的MEX值
输入
5
0 1 2 3 3
输出
0 1 2 4 4
扫码备注加群即可,期待您的到来~
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.