自用板子
```
//离散化大概写法(参考题目https://www.luogu.com.cn/problem/UVA10587)
int lisan()
{//读入并进行离散处理
n = read();
tot = 0;
for(int i = 1;i <= n;i++)
{ a[i].l = read(),
a[i].r = read(),
b[++tot] = a[i].l,
b[++tot] = a[i].r,
b[++tot] = a[i].r + 1;//题目需求;
}
sort(b + 1,b + tot + 1);
int len=unique(b + 1,b + tot + 1) - b - 1;
for(int i = 1; i <= n;i++)
a[i].l = lower_bound(b + 1,b + len + 1,a[i].l) - b,
a[i].r = lower_bound(b + 1,b + len + 1,a[i].r) - b; //将b[i]值对应的数组下标赋值给 a[] 数组;
return len; //离散化后总共处理多长的墙;
}
```