#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int a[500005],b[500005],n;
int main() {
scanf("%d",&n);
for(int i = 1;i <= n;++ i) scanf("%d",&a[i]),b[i] = a[i];
sort(b + 1,b + n + 1);
int c = unique(b + 1,b + n + 1) - b - 1;
for(int i = 1;i <= n;++ i) a[i] = lower_bound(b + 1,b + c + 1,a[i]) - b;
return 0;
}
标签:std,main,int,离散,include,500005
From: https://www.cnblogs.com/eegg/p/16886980.html