修改数组
using namespace std;
const int N = 1e6 + 1e5 + 10;
int p[N];
int find(int x) // 并查集
{
if (p[x] != x) p[x] = find(p[x]);
return p[x];
}
int main()
{
int n;
cin >>n;
for(int i = 1; i <= N; i ++)p[i] = i;
for(int i = 1; i <= n; i ++)
{
int x;
cin >> x;
x =find(x);
cout << x<<" ";
p[x] = x + 1;
}
}