#P1864. Nested Segments
Nested Segments
Nested Segments
题面翻译
在一条直线上有条线段,每条线段用表示,求每条线段包含多少条其他的线段。
题目描述
You are given segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains.
输入格式
The first line contains a single integer ( ) — the number of segments on a line.
Each of the next lines contains two integers and ( -10^{9}<=l_{i}<r_{i}<=10^{9} ) — the coordinates of the left and the right ends of the -th segment. It is guaranteed that there are no ends of some segments that coincide.
输出格式
Print lines. The -th of them should contain the only integer — the number of segments contained in the -th segment.
样例 #1
样例输入 #1
4
1 8
2 3
4 7
5 6
样例输出 #1
3
0
1
0
样例 #2
样例输入 #2
3
3 4
1 5
2 6
样例输出 #2
0
1
1