离散化
(说明后补)
cin >> n;
for (int i = 1;i <= n; ++i) {
cin >> B[i];
C[i] = B[i];
}
sort(C+1,C+n+1);
int m = unique(C+1,C+n+1) - C-1;
for (int i = 1;i <= n; ++i) {
B[i] = lower_bound(C+1,C+m+1,B[i]) - C;
}
for (int i = 1;i <= n; ++i) {
cout << C[B[i]] << " ";
}
cout << endl;