2009_10-5_Practice1 C

来源:互联网 发布:阐教 截教 知乎 编辑:程序博客网 时间:2024/04/29 09:42

<!--@page { margin: 2cm }P { margin-bottom: 0.21cm }-->

IntervalChallenge

TimeLimit: 6000/2000 MS (Java/Others)    MemoryLimit: 65536/32768 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

ProblemDescription

 Giveyou N ( 1 <= N <= 200000 ) intervals, represented as [A, B],for example , interval s represented as [As, Bs].

Fortwo intervals s and t, we say S covered by T if At <= As and Bs<= Bt.

Nowmy problem is easy, just tell me the question below:

Foreach interval, how many intervals can cover it but not covered by it?

 

Input

Theinput contains multiple test cases.
For each test case, the firstline is an integer N ( 1 <= N <= 200000 ), which is the numberof intervals. Then come N lines, the i-th of which contains twointegers: A
i andBi ( Ai , Biwill not exceed the unsigned 32-bit integer) specifying the two parameters describedabove.

 

Output

Foreach test case, output one line containing n space-separatedintegers, the i-th of which specifying the number of intervals thatcan cover it but not covered by it. 

 

SampleInput

3

01

-12

-23

 

2

01

01

 

SampleOutput

21 0

00

 

Author

WhereIsHeroFrom

 

原创粉丝点击