INTERVA2  Interval Challenge
Give you N ( 1 <= N <= 200000 ) intervals, represented as [A, B], for example , interval s represented as [As,Bs].
For two intervals s and t, we say S covered by T if At <= As and Bs <= Bt. Now my problem is easy, just tell me the question below: For each interval, how many intervals can cover it but not covered by it ?
Input
The input contains multiple test cases.
For each test case, the first line is an integer N ( 1 <= N <= 200000 ), which is the number of intervals. Then come N lines, the ith of which contains two integers: A_{i} and Bi ( A_{i }, B_{i }will not exceed the 32bit integer) specifying the two parameters described above.
Output
For each test case, output one line containing n spaceseparated integers, the ith of which specifying the number of intervals that can cover it but not covered by it.
Example
Input3
0 1
1 2
2 3
2
0 1
0 1
Output:2 1 0
0 0
hide comments
Felipe GetÃºlio:
20180819 16:51:59
what is the obvious optimization? 

pran4798:
20170407 21:47:03
how we can use bitmask, please give me some hint. 

VV:
20130521 16:49:04
No kind of weird optimization required for this problem! Got AC in first try. Just do the obvious optimization. Last edit: 20130521 17:29:07 

Pushkar Mishra:
20130506 03:02:26
No IO optimizations required. Just avoid maps, and other predefined containers or classes. 

Robin Lee:
20110830 00:37:44
Writing solution: Fun.


Ashish Massand:
20110621 07:18:19
Got it forgot the fact that the interval shouldn't cover the interval that covers it. 

Ashish Massand:
20110621 07:17:40
Could someone explain the second test case. Shouldn't the answer be


:D:
20110111 11:23:04
You probably can get away with standard I/O but it is highly dependent on implementation details. I would suggest doing both fast 'I' and 'O' :) 

~!(*(@*!@^&:
20100415 21:35:07
i dont use fast IO but I need to use C++ 4.3.2 

P != NP:
20100331 21:49:06
This is too much......It needs IO optimizations to get accepted.....I tried almost 15 times before i got AC. 
Added by:  Hemant Verma 
Date:  20091114 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  Alkhwarizm 2009 