离散化处理
用途
数据范围很大(1~m),但使用的数据不大(1~n),且不考虑具体值,只需要用其相对大小的时候,将各个数大小从1到n进行排名
法一(无重复元素)
b[ ]中第k大的数是b[ a[ k ] ]
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=500005;
int a[maxn],b[maxn];
bool cmp(const int x,const int y)
{
原创
2021-05-05 13:46:13 ·
131 阅读 ·
0 评论