离散化

vector  V;
int N;
int a[MAXN];
int x;
int main () {
	cin >> N;
	REP(i,N) {
		cin >> x;
		V.push_back(make_pair(x,i));
	}
	sort(V.begin(),V.end());
	REP(i,N) a[V[i].second] = i;
}

 

转载于:https://www.cnblogs.com/xiaoshanshan/p/4314031.html

你可能感兴趣的:(离散化)