U593161 二维偏序(严格小于)
题目描述
给定 $n$ 个二元组,第 $i$ 个二元组记为 $(x_i,y_i)$。
对于每个 $i$,你需要求出有多少个 $j$ 满足:
- $x_j
输入格式
第一行包含一个正整数 $n$,表示二元组的个数。
接下来 $n$ 行,每行两个整数 $x,y$,描述一个二元组。
输出格式
输出 $n$ 行,第 $i$ 行表示对应的 $j$ 的个数。
说明/提示
[[笔记]CDQ 分治](https://www.cnblogs.com/Sinktank/p/19045786)
#### 数据范围
对于所有数据:
- $1\le n\le 5\times 10^5$
- $1\le x_i,y_i\le 10^6$
|测试点编号|$n\le$|$x_i,y_i\le$|
|:-:|:-:|:-:|
|$1\sim 5$|$10^3$|$10$|
|$6\sim 10$|$5\times 10^5$|$10$|
|$11\sim 15$|$5\times 10^5$|$10^3$|
|$16\sim 20$|$5\times 10^5$|$10^6$|
请使用较快的读写方式。
时限已经开到 cdq 实现的 $3$ 倍以上。
::::info[std([R229152728](https://www.luogu.com.cn/record/229152728))]
```cpp
#include
using namespace std;
const int N=5e5+10;
struct Node{int x,y,id;}a[N